This commit is contained in:
Mateusz Gruszczyński committed 2026-09-15 09:04:29 +02:00
1 parent 0a2fb8c6c7
commit 2ff310bdc5
37 files changed
+731 -141

No files matched your search

+31 -1
View File
@@ -352,6 +352,7 @@ mod tests {
assert!(automation_action_conflicts_with_thermostat(&DeviceCommand { mode: Some("dry".into()), ..Default::default() }));
assert!(!automation_action_conflicts_with_thermostat(&DeviceCommand { mode: Some("heat".into()), ..Default::default() }));
assert!(!automation_action_conflicts_with_thermostat(&DeviceCommand { light: Some(false), turbo: Some(true), ..Default::default() }));
assert!(!automation_action_conflicts_with_thermostat(&DeviceCommand { swing_vertical: Some(true), swing_horizontal: Some(false), ..Default::default() }));
}
#[test]
@@ -988,9 +989,38 @@ mod tests {
let mut c = Device::simulated_default();
c.id = "sim-c".into();
c.outdoor_temperature = Some(40.0);
assert_eq!(gree_outdoor_temperature(&[a, b, c]), Some(12.0));
assert_eq!(gree_outdoor_temperature(&[a, b, c], &[]), Some(12.0));
}
#[test]
fn gree_outdoor_fallback_counts_multisplit_once() {
let mut a = Device::simulated_default();
a.id = "a".into();
a.outdoor_temperature = Some(10.0);
let mut b = Device::simulated_default();
b.id = "b".into();
b.outdoor_temperature = Some(10.0);
let mut c = Device::simulated_default();
c.id = "c".into();
c.outdoor_temperature = Some(30.0);
let now = Utc::now();
let group = DeviceGroup {
id: "multi".into(),
name: "Multi".into(),
kind: crate::models::DeviceGroupKind::Multisplit,
device_ids: vec!["a".into(), "b".into()],
energy_source: EnergySourcePreference::Auto,
energy_device_id: None,
ha_energy_entity_id: None,
ha_energy_unit: None,
ha_energy_device_class: None,
ha_energy_state_class: None,
outdoor_temperature_device_id: Some("a".into()),
created_at: now,
updated_at: now,
};
assert_eq!(gree_outdoor_temperature(&[a, b, c], &[group]), Some(20.0));
}
#[test]
fn global_one_shot_queue_does_not_change_zone_ownership() {