v0.13.6
This commit is contained in:
+22
-1
@@ -43,13 +43,15 @@ fn alert_type_enabled(cfg: &NotificationSettings, kind: &str) -> bool {
|
||||
if kind.starts_with("automation.") {
|
||||
return types.automation;
|
||||
}
|
||||
if kind == "zone.sensor_discrepancy" {
|
||||
return types.sensor_discrepancy;
|
||||
}
|
||||
if matches!(
|
||||
kind,
|
||||
"zone.action_error"
|
||||
| "zone.mode_change_off_error"
|
||||
| "zone.local_power_error"
|
||||
| "zone.device_missing"
|
||||
| "zone.sensor_discrepancy"
|
||||
| "zone.temporary_quick_thermostat_cancelled"
|
||||
| "zone.temporary_quick_thermostat_poweroff_error"
|
||||
| "group.power_error"
|
||||
@@ -142,6 +144,25 @@ pub async fn dispatch(
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn sensor_discrepancy_has_its_own_notification_toggle() {
|
||||
let mut cfg = NotificationSettings::default();
|
||||
cfg.alert_types.control_errors = true;
|
||||
cfg.alert_types.sensor_discrepancy = false;
|
||||
assert!(!alert_type_enabled(&cfg, "zone.sensor_discrepancy"));
|
||||
assert!(alert_type_enabled(&cfg, "zone.action_error"));
|
||||
|
||||
cfg.alert_types.control_errors = false;
|
||||
cfg.alert_types.sensor_discrepancy = true;
|
||||
assert!(alert_type_enabled(&cfg, "zone.sensor_discrepancy"));
|
||||
assert!(!alert_type_enabled(&cfg, "zone.action_error"));
|
||||
}
|
||||
}
|
||||
|
||||
async fn send_pushover(
|
||||
state: &AppState,
|
||||
cfg: &NotificationSettings,
|
||||
|
||||
Reference in New Issue
Block a user