This commit is contained in:
Mateusz Gruszczyński
2026-08-25 18:10:51 +02:00
parent 440c7c3a8d
commit 26d8f9f83a
21 changed files with 1031 additions and 98 deletions
+41
View File
@@ -35,6 +35,7 @@ fn default_influx_threshold_days() -> u32 { 30 }
fn default_night_start() -> String { "22:00".into() }
fn default_night_end() -> String { "06:00".into() }
fn default_night_max_fan_speed() -> u8 { 1 }
fn default_group_power_enabled() -> bool { true }
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Device {
@@ -342,6 +343,30 @@ pub struct Zone {
fn default_sensor_source() -> String { "device".into() }
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ClimateGroup {
pub id: String,
pub name: String,
#[serde(default)]
pub zone_ids: Vec<String>,
#[serde(default = "default_group_power_enabled")]
pub power_enabled: bool,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct GroupControlPatch {
#[serde(default)]
pub power: Option<bool>,
/// house follows the global house mode; cool/heat set an explicit mode on every member zone.
#[serde(default)]
pub mode: Option<String>,
/// auto clears temporary overrides; comfort/sleep/away apply a temporary preset to every member zone.
#[serde(default)]
pub preset: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct ZoneControlPatch {
#[serde(default)]
@@ -392,7 +417,15 @@ pub struct Automation {
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")]
@@ -613,6 +646,8 @@ pub struct ConfigurationExport {
pub settings: RuntimeSettings,
pub devices: Vec<Device>,
pub zones: Vec<Zone>,
#[serde(default)]
pub groups: Vec<ClimateGroup>,
pub schedules: Vec<Schedule>,
pub automations: Vec<Automation>,
}
@@ -662,6 +697,12 @@ pub struct AutomationPlanRule {
pub at_time: Option<String>,
pub action_device_id: String,
pub action_device_name: String,
#[serde(default)]
pub action_group_id: Option<String>,
#[serde(default)]
pub action_group_name: Option<String>,
#[serde(default)]
pub action_preset: Option<String>,
pub action: DeviceCommand,
pub last_fired_at: Option<DateTime<Utc>>,
pub next_ready_at: Option<DateTime<Utc>>,