Start to build relay dialog
This commit is contained in:
		@@ -45,6 +45,18 @@ pub struct StaticConstraints {
 | 
			
		||||
    pub dev_name_len: SizeConstraint,
 | 
			
		||||
    /// Device description constraint
 | 
			
		||||
    pub dev_description_len: SizeConstraint,
 | 
			
		||||
    /// Relay name constraint
 | 
			
		||||
    pub relay_name_len: SizeConstraint,
 | 
			
		||||
    /// Relay priority constraint
 | 
			
		||||
    pub relay_priority: SizeConstraint,
 | 
			
		||||
    /// Relay consumption constraint
 | 
			
		||||
    pub relay_consumption: SizeConstraint,
 | 
			
		||||
    /// Relay minimal uptime
 | 
			
		||||
    pub relay_minimal_uptime: SizeConstraint,
 | 
			
		||||
    /// Relay minimal downtime
 | 
			
		||||
    pub relay_minimal_downtime: SizeConstraint,
 | 
			
		||||
    /// Relay daily minimal uptime
 | 
			
		||||
    pub relay_daily_minimal_runtime: SizeConstraint,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl Default for StaticConstraints {
 | 
			
		||||
@@ -52,6 +64,12 @@ impl Default for StaticConstraints {
 | 
			
		||||
        Self {
 | 
			
		||||
            dev_name_len: SizeConstraint::new(1, 50),
 | 
			
		||||
            dev_description_len: SizeConstraint::new(0, 100),
 | 
			
		||||
            relay_name_len: SizeConstraint::new(1, 100),
 | 
			
		||||
            relay_priority: SizeConstraint::new(0, 999999),
 | 
			
		||||
            relay_consumption: SizeConstraint::new(0, 999999),
 | 
			
		||||
            relay_minimal_uptime: SizeConstraint::new(0, 9999999),
 | 
			
		||||
            relay_minimal_downtime: SizeConstraint::new(0, 9999999),
 | 
			
		||||
            relay_daily_minimal_runtime: SizeConstraint::new(0, 3600 * 24),
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -67,7 +67,7 @@ pub struct Device {
 | 
			
		||||
/// time of a device
 | 
			
		||||
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
 | 
			
		||||
pub struct DailyMinRuntime {
 | 
			
		||||
    /// Minimum time, in seconds, that this relay should run
 | 
			
		||||
    /// Minimum time, in seconds, that this relay should run each day
 | 
			
		||||
    pub min_runtime: usize,
 | 
			
		||||
    /// The seconds in the days (from 00:00) where the counter is reset
 | 
			
		||||
    pub reset_time: usize,
 | 
			
		||||
@@ -87,13 +87,13 @@ pub struct DeviceRelay {
 | 
			
		||||
    name: String,
 | 
			
		||||
    /// Whether this relay can be turned on or not
 | 
			
		||||
    enabled: bool,
 | 
			
		||||
    /// Relay priority when selecting relays to turn of / on. 0 = lowest priority
 | 
			
		||||
    /// Relay priority when selecting relays to turn on. 0 = lowest priority
 | 
			
		||||
    priority: usize,
 | 
			
		||||
    /// Estimated consumption of the electrical equipment triggered by the relay
 | 
			
		||||
    consumption: usize,
 | 
			
		||||
    /// Minimal time this relay shall be left on before it can be turned off
 | 
			
		||||
    /// Minimal time this relay shall be left on before it can be turned off (in seconds)
 | 
			
		||||
    minimal_uptime: usize,
 | 
			
		||||
    /// Minimal time this relay shall be left off before it can be turned on again
 | 
			
		||||
    /// Minimal time this relay shall be left off before it can be turned on again (in seconds)
 | 
			
		||||
    minimal_downtime: usize,
 | 
			
		||||
    /// Optional minimal runtime requirements for this relay
 | 
			
		||||
    daily_runtime: Option<DailyMinRuntime>,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user