This commit is contained in:
Mateusz Gruszczyński committed 2026-09-01 09:19:33 +02:00
1 parent ac5a464d96
commit 1a5c1305dc
20 files changed
+200 -42

No files matched your search

+18
View File
@@ -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() }