v0.15.21
This commit is contained in:
1 parent
aa1cb05b2f
commit
8a7501e4ab
9 files changed
+175
-32
No files matched your search
@@ -227,6 +227,65 @@ mod tests {
|
||||
assert!(cron_matches("0 8 * * 1-7", &sunday));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn flow_zone_action_noop_detects_persisted_on_intent_and_real_off_state() {
|
||||
let mut zone = test_zone("device");
|
||||
zone.inherit_house_mode = false;
|
||||
zone.mode = "heat".into();
|
||||
zone.manual_preset = Some("custom".into());
|
||||
zone.manual_setpoint = Some(20.0);
|
||||
zone.effective_mode = "heat".into();
|
||||
let on = DeviceCommand {
|
||||
power: Some(true),
|
||||
mode: Some("heat".into()),
|
||||
target_temperature: Some(20.0),
|
||||
..Default::default()
|
||||
};
|
||||
assert!(flow_zone_action_already_satisfied(
|
||||
&zone, false, 0, 0, Some("custom"), &on
|
||||
));
|
||||
|
||||
zone.manual_preset = None;
|
||||
zone.manual_setpoint = None;
|
||||
zone.manual_override_until = None;
|
||||
zone.effective_mode = "off".into();
|
||||
zone.device_setpoint = None;
|
||||
zone.demand = false;
|
||||
let off = DeviceCommand {
|
||||
power: Some(false),
|
||||
mode: Some("heat".into()),
|
||||
..Default::default()
|
||||
};
|
||||
assert!(flow_zone_action_already_satisfied(
|
||||
&zone, false, 0, 0, Some("auto"), &off
|
||||
));
|
||||
assert!(!flow_zone_action_already_satisfied(
|
||||
&zone, true, 0, 0, Some("auto"), &off
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn flow_zone_action_noop_keeps_auxiliary_swing_changes_executable() {
|
||||
let mut zone = test_zone("device");
|
||||
zone.inherit_house_mode = false;
|
||||
zone.mode = "heat".into();
|
||||
zone.manual_preset = Some("custom".into());
|
||||
zone.manual_setpoint = Some(20.0);
|
||||
let action = DeviceCommand {
|
||||
power: Some(true),
|
||||
mode: Some("heat".into()),
|
||||
target_temperature: Some(20.0),
|
||||
swing_vertical: Some(1),
|
||||
..Default::default()
|
||||
};
|
||||
assert!(!flow_zone_action_already_satisfied(
|
||||
&zone, true, 0, 0, Some("custom"), &action
|
||||
));
|
||||
assert!(flow_zone_action_already_satisfied(
|
||||
&zone, true, 1, 0, Some("custom"), &action
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn flow_timed_gate_requires_continuity_and_resets_on_false() {
|
||||
let mut state = crate::models::FlowRuntimeNodeState::default();
|
||||
|
||||
Reference in new issue
Block a user