This commit is contained in:
Mateusz Gruszczyński committed 2026-09-01 14:33:45 +02:00
1 parent d0346dd797
commit 3c490b3064
22 files changed
+158 -111

No files matched your search

+30
View File
@@ -780,4 +780,34 @@ mod tests {
assert_eq!(outdoor_assist_offset("cool", None, 27.0, 23.0), 0.0);
}
#[test]
fn whole_house_off_is_indefinite_until_explicit_reenable() {
let mut zone = test_zone("device");
zone.local_thermostat_power = Some(true);
zone.local_thermostat_resume_at = Some(Utc::now() + chrono::Duration::minutes(15));
zone.demand = true;
zone.demand_since = Some(Utc::now());
assert!(set_house_bulk_thermostat_power(&mut zone, false));
assert_eq!(zone.local_thermostat_power, Some(false));
assert!(zone.local_thermostat_resume_at.is_none());
assert!(zone.local_thermostat_restore_zone_enabled.is_none());
assert!(!zone.demand);
assert!(zone.demand_since.is_none());
assert_eq!(zone.effective_mode, "off");
// A normal cycle must see an indefinite local OFF. Global/local/group ON releases it.
assert!(set_house_bulk_thermostat_power(&mut zone, true));
assert!(zone.local_thermostat_power.is_none());
assert!(zone.local_thermostat_resume_at.is_none());
}
#[test]
fn whole_house_on_does_not_create_a_local_on_override() {
let mut zone = test_zone("device");
zone.local_thermostat_power = None;
assert!(!set_house_bulk_thermostat_power(&mut zone, true));
assert!(zone.local_thermostat_power.is_none());
}
}