This commit is contained in:
Mateusz Gruszczyński
2026-09-01 09:19:33 +02:00
parent ac5a464d96
commit 1a5c1305dc
20 changed files with 200 additions and 42 deletions
+16 -1
View File
@@ -107,7 +107,8 @@ mod tests {
mode: "heat".into(), inherit_house_mode: true, setpoint: 21.0, profile_version: 1,
cool_comfort_setpoint: 23.0, cool_sleep_setpoint: 24.5, cool_away_setpoint: 27.0,
heat_comfort_setpoint: 21.0, heat_sleep_setpoint: 19.0, heat_away_setpoint: 17.0,
hysteresis: 0.6, min_on_seconds: 180, min_off_seconds: 180, min_adjust_seconds: 120, standby_offset_c: 2.0, smart_fan: true,
hysteresis: 0.6, separate_hysteresis: false, cool_hysteresis: 0.6, heat_hysteresis: 0.6,
min_on_seconds: 180, min_off_seconds: 180, min_adjust_seconds: 120, standby_offset_c: 2.0, smart_fan: true,
sensor_source: source.into(), ha_entity_id: Some("sensor.room_temperature".into()),
external_sensor_weight: 0.4, max_sensor_difference: 3.0, sensor_stale_after_seconds: 300, device_temperature: None, external_temperature: None,
current_temperature: None, control_temperature_source: "device".into(), active_preset: "comfort".into(),
@@ -119,6 +120,20 @@ mod tests {
}
}
#[test]
fn zone_can_use_separate_heating_and_cooling_hysteresis() {
let mut zone = test_zone("device");
zone.hysteresis = 0.6;
zone.separate_hysteresis = true;
zone.cool_hysteresis = 0.4;
zone.heat_hysteresis = 1.2;
assert_eq!(zone.hysteresis_for_mode("cool"), 0.4);
assert_eq!(zone.hysteresis_for_mode("heat"), 1.2);
zone.separate_hysteresis = false;
assert_eq!(zone.hysteresis_for_mode("cool"), 0.6);
assert_eq!(zone.hysteresis_for_mode("heat"), 0.6);
}
#[test]
fn external_device_change_detects_manual_climate_controls() {
let zone = test_zone("device");