v0.8.17
This commit is contained in:
1 parent
ac5a464d96
commit
1a5c1305dc
20 files changed
+200
-42
No files matched your search
@@ -30,6 +30,13 @@ pub struct Zone {
|
||||
pub heat_away_setpoint: f64,
|
||||
#[serde(default = "default_hysteresis")]
|
||||
pub hysteresis: f64,
|
||||
/// When enabled, heating and cooling use independent hysteresis values.
|
||||
#[serde(default)]
|
||||
pub separate_hysteresis: bool,
|
||||
#[serde(default = "default_hysteresis")]
|
||||
pub cool_hysteresis: f64,
|
||||
#[serde(default = "default_hysteresis")]
|
||||
pub heat_hysteresis: f64,
|
||||
#[serde(default = "default_min_cycle")]
|
||||
pub min_on_seconds: u64,
|
||||
#[serde(default = "default_min_cycle")]
|
||||
@@ -153,6 +160,17 @@ pub struct Zone {
|
||||
pub updated_at: DateTime<Utc>,
|
||||
}
|
||||
|
||||
impl Zone {
|
||||
pub fn hysteresis_for_mode(&self, mode: &str) -> f64 {
|
||||
let value = if self.separate_hysteresis {
|
||||
if mode == "heat" { self.heat_hysteresis } else { self.cool_hysteresis }
|
||||
} else {
|
||||
self.hysteresis
|
||||
};
|
||||
value.max(0.1)
|
||||
}
|
||||
}
|
||||
|
||||
fn default_sensor_source() -> String { "device".into() }
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user