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
+110
View File
@@ -0,0 +1,110 @@
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ConfigurationExport {
pub format_version: u32,
pub exported_at: DateTime<Utc>,
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>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ControlPlanEvent {
pub at: DateTime<Utc>,
pub kind: String,
pub label: String,
pub preset: Option<String>,
pub target_temperature: Option<f64>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ZoneControlPlan {
pub zone_id: String,
pub zone_name: String,
pub device_id: String,
pub device_name: String,
/// Configured per-zone enable switch. Group/master gates are reported separately.
pub enabled: bool,
/// True when the configured zone is not currently blocked by a disabled climate group.
pub effective_enabled: bool,
/// Effective mode currently used by the controller.
pub mode: String,
/// Configured zone mode before house-mode inheritance is resolved.
pub configured_mode: String,
pub inherit_house_mode: bool,
/// Profile resolved from a manual override or the active schedule.
pub preset: String,
/// Explicit per-zone profile override; None means Auto schedule.
pub preset_override: Option<String>,
pub current_temperature: Option<f64>,
pub target_temperature: Option<f64>,
pub device_setpoint: Option<f64>,
pub desired_power: bool,
pub desired_mode: String,
pub actual_power: Option<bool>,
pub actual_mode: Option<String>,
pub actual_setpoint: Option<f64>,
pub demand: bool,
pub control_source: String,
pub manual_override_until: Option<DateTime<Utc>>,
pub local_thermostat_power: Option<bool>,
pub local_thermostat_resume_at: Option<DateTime<Utc>>,
pub device_manual_override: bool,
pub device_manual_override_until: Option<DateTime<Utc>>,
pub control_owner: String,
pub control_command_source: String,
pub control_since: Option<DateTime<Utc>>,
pub resume_at: Option<DateTime<Utc>>,
pub control_reason: String,
pub blocked_reason: Option<String>,
pub lockout_until: Option<DateTime<Utc>>,
pub current_schedule_id: Option<String>,
pub current_schedule_name: Option<String>,
pub next_events: Vec<ControlPlanEvent>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AutomationPlanRule {
pub id: String,
pub name: String,
pub enabled: bool,
pub trigger_kind: String,
pub trigger_device_id: Option<String>,
pub trigger_device_name: Option<String>,
pub threshold: Option<f64>,
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>>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ControlPlan {
pub generated_at: DateTime<Utc>,
pub house_mode: String,
/// Uniform whole-house preset when every zone uses the same override; None for a mixed state.
pub house_preset: Option<String>,
/// Whole-house master power state.
pub house_power: bool,
pub outdoor_temperature: Option<f64>,
pub control_strategy: String,
pub night_mode_active: bool,
pub night_mode_start: String,
pub night_mode_end: String,
pub night_mode_max_fan_speed: u8,
pub next_events: Vec<ControlPlanEvent>,
pub zones: Vec<ZoneControlPlan>,
pub rules: Vec<AutomationPlanRule>,
}