This commit is contained in:
Mateusz Gruszczyński
2026-08-29 22:07:54 +02:00
parent 930cb7b1e1
commit 2383526a83
16 changed files with 296 additions and 79 deletions
+41
View File
@@ -764,6 +764,43 @@ impl Default for InfluxDbSettings {
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct NotificationAlertTypes {
/// Home Assistant sensor exceeded the configured freshness window.
#[serde(default = "default_true")]
pub stale_sensor: bool,
/// Other Home Assistant sensor errors (missing/unavailable/invalid value).
#[serde(default = "default_true")]
pub sensor_errors: bool,
/// Device connectivity, polling and communication problems.
#[serde(default = "default_true")]
pub communication: bool,
/// Zone failed to reach its target within the configured timeout.
#[serde(default = "default_true")]
pub target_timeout: bool,
/// Automation execution errors and conflicts.
#[serde(default = "default_true")]
pub automation: bool,
/// Thermostat/group/device control failures and sensor discrepancies.
#[serde(default = "default_true")]
pub control_errors: bool,
/// Informational state changes sent when notification mode is "important".
#[serde(default = "default_true")]
pub important_events: bool,
/// Any warning/error not matched by one of the categories above.
#[serde(default = "default_true")]
pub other: bool,
}
impl Default for NotificationAlertTypes {
fn default() -> Self {
Self {
stale_sensor: true, sensor_errors: true, communication: true, target_timeout: true,
automation: true, control_errors: true, important_events: true, other: true,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct NotificationSettings {
#[serde(default)]
@@ -788,6 +825,9 @@ pub struct NotificationSettings {
pub communication_failure_threshold: u32,
#[serde(default = "default_notification_target_timeout")]
pub target_timeout_minutes: u32,
/// Fine-grained selection of which alert categories may be delivered.
#[serde(default)]
pub alert_types: NotificationAlertTypes,
}
fn default_notification_mode() -> String { "problems".into() }
@@ -805,6 +845,7 @@ impl Default for NotificationSettings {
cooldown_seconds: default_notification_cooldown(),
communication_failure_threshold: default_notification_failure_threshold(),
target_timeout_minutes: default_notification_target_timeout(),
alert_types: NotificationAlertTypes::default(),
}
}
}