This commit is contained in:
Mateusz Gruszczyński committed 2026-10-11 17:02:19 +02:00
1 parent 8a7501e4ab
commit 8e8559939a
19 files changed
+144 -55

No files matched your search

+44
View File
@@ -286,6 +286,44 @@ mod tests {
));
}
#[test]
fn flow_off_normalizes_concrete_hvac_mode_without_mapping_auto_to_device_auto() {
let heat = DeviceCommand {
power: Some(false),
mode: Some("heat".into()),
..Default::default()
};
let cool = DeviceCommand {
power: Some(false),
mode: Some("cool".into()),
..Default::default()
};
let auto = DeviceCommand {
power: Some(false),
mode: Some("auto".into()),
..Default::default()
};
assert_eq!(flow_off_physical_mode(&heat).as_deref(), Some("heat"));
assert_eq!(flow_off_physical_mode(&cool).as_deref(), Some("cool"));
assert_eq!(flow_off_physical_mode(&auto), None);
}
#[test]
fn flow_owned_thermostat_does_not_receive_global_outdoor_assist() {
assert_eq!(
thermostat_outdoor_assist_temperature(true, "automation.flow", Some(-5.0)),
None
);
assert_eq!(
thermostat_outdoor_assist_temperature(true, "schedule", Some(-5.0)),
Some(-5.0)
);
assert_eq!(
thermostat_outdoor_assist_temperature(false, "schedule", Some(-5.0)),
None
);
}
#[test]
fn flow_timed_gate_requires_continuity_and_resets_on_false() {
let mut state = crate::models::FlowRuntimeNodeState::default();
@@ -1342,6 +1380,12 @@ mod tests {
assert_eq!(zone.control_owner, "automation");
assert_eq!(zone.control_source, "automation.device");
assert!(zone_has_active_thermostat_intent(&zone, None, Utc::now()));
zone.control_source = "automation.flow".into();
refresh_control_ownership(&mut zone);
assert_eq!(zone.control_owner, "automation");
assert_eq!(zone.control_source, "automation.flow");
assert!(!zone_has_active_thermostat_intent(&zone, None, Utc::now()));
}
#[test]