v0.6.0
This commit is contained in:
@@ -326,6 +326,10 @@ pub struct Zone {
|
||||
#[serde(default)]
|
||||
pub demand: bool,
|
||||
#[serde(default)]
|
||||
pub demand_since: Option<DateTime<Utc>>,
|
||||
#[serde(default)]
|
||||
pub target_alerted_at: Option<DateTime<Utc>>,
|
||||
#[serde(default)]
|
||||
pub last_action_at: Option<DateTime<Utc>>,
|
||||
pub created_at: DateTime<Utc>,
|
||||
pub updated_at: DateTime<Utc>,
|
||||
@@ -512,6 +516,52 @@ impl Default for InfluxDbSettings {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct NotificationSettings {
|
||||
#[serde(default)]
|
||||
pub enabled: bool,
|
||||
/// problems = warnings/errors/anomalies, important = problems plus important state changes.
|
||||
#[serde(default = "default_notification_mode")]
|
||||
pub mode: String,
|
||||
/// pushover, slack, discord
|
||||
#[serde(default = "default_notification_provider")]
|
||||
pub provider: String,
|
||||
#[serde(default)]
|
||||
pub pushover_app_token: String,
|
||||
#[serde(default)]
|
||||
pub pushover_user_key: String,
|
||||
#[serde(default)]
|
||||
pub slack_webhook_url: String,
|
||||
#[serde(default)]
|
||||
pub discord_webhook_url: String,
|
||||
#[serde(default = "default_notification_cooldown")]
|
||||
pub cooldown_seconds: u64,
|
||||
#[serde(default = "default_notification_failure_threshold")]
|
||||
pub communication_failure_threshold: u32,
|
||||
#[serde(default = "default_notification_target_timeout")]
|
||||
pub target_timeout_minutes: u32,
|
||||
}
|
||||
|
||||
fn default_notification_mode() -> String { "problems".into() }
|
||||
fn default_notification_provider() -> String { "pushover".into() }
|
||||
fn default_notification_cooldown() -> u64 { 300 }
|
||||
fn default_notification_failure_threshold() -> u32 { 3 }
|
||||
fn default_notification_target_timeout() -> u32 { 60 }
|
||||
|
||||
impl Default for NotificationSettings {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
enabled: false, mode: default_notification_mode(), provider: default_notification_provider(),
|
||||
pushover_app_token: String::new(), pushover_user_key: String::new(),
|
||||
slack_webhook_url: String::new(), discord_webhook_url: String::new(),
|
||||
cooldown_seconds: default_notification_cooldown(),
|
||||
communication_failure_threshold: default_notification_failure_threshold(),
|
||||
target_timeout_minutes: default_notification_target_timeout(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
|
||||
pub struct DebugSettings {
|
||||
#[serde(default)]
|
||||
@@ -661,6 +711,8 @@ pub struct RuntimeSettings {
|
||||
pub debug: DebugSettings,
|
||||
#[serde(default)]
|
||||
pub night_mode: NightModeSettings,
|
||||
#[serde(default)]
|
||||
pub notifications: NotificationSettings,
|
||||
pub home_assistant: HomeAssistantSettings,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user