This commit is contained in:
Mateusz Gruszczyński
2026-08-30 13:39:29 +02:00
parent 3e950ab5fa
commit 5c05eddb8f
83 changed files with 10130 additions and 9954 deletions
+54
View File
@@ -0,0 +1,54 @@
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Schedule {
pub id: String,
pub zone_id: String,
pub name: String,
#[serde(default = "default_true")]
pub enabled: bool,
/// ISO weekday numbers, Monday=1, Sunday=7.
pub weekdays: Vec<u32>,
/// Local time HH:MM.
pub start_time: String,
/// Local time HH:MM. Ranges crossing midnight are supported.
pub end_time: String,
/// comfort/sleep/away/custom. Non-custom profiles resolve their target from the zone.
#[serde(default = "default_schedule_preset")]
pub preset: String,
pub setpoint: f64,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Automation {
pub id: String,
pub name: String,
#[serde(default = "default_true")]
pub enabled: bool,
/// temperature_above, temperature_below, time
pub trigger_kind: String,
#[serde(default)]
pub trigger_device_id: Option<String>,
#[serde(default)]
pub threshold: Option<f64>,
#[serde(default)]
pub at_time: Option<String>,
/// Legacy/direct-device target. Empty when this automation targets a group.
#[serde(default)]
pub action_device_id: String,
/// Optional climate group target. When set, the action is applied to every member zone/device.
#[serde(default)]
pub action_group_id: Option<String>,
/// Optional thermostat preset used only for group actions.
#[serde(default)]
pub action_preset: Option<String>,
#[serde(default)]
pub action: DeviceCommand,
#[serde(default = "default_cooldown")]
pub cooldown_seconds: u64,
#[serde(default)]
pub last_fired_at: Option<DateTime<Utc>>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}