This commit is contained in:
Mateusz Gruszczyński
2026-08-28 09:44:39 +02:00
parent 016aac0f8d
commit d159795267
16 changed files with 782 additions and 48 deletions
+62
View File
@@ -37,6 +37,7 @@ 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 }
fn default_temporary_tolerance() -> f64 { 0.3 }
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Device {
@@ -268,6 +269,56 @@ impl From<&Device> for ManualDeviceBaseline {
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TemporaryQuickThermostat {
/// duration | until | temperature_reached | temperature_stable | schedule_boundary
pub finish_kind: String,
pub started_at: DateTime<Utc>,
/// Zone automation enabled-state from before the temporary session. A temporary
/// Quick Thermostat may run even when normal automation was disabled, then restore it.
#[serde(default)]
pub restore_zone_enabled: Option<bool>,
/// Hard end for duration/until/schedule-boundary modes.
#[serde(default)]
pub expires_at: Option<DateTime<Utc>>,
/// Temperature condition used by reached/stable modes.
#[serde(default)]
pub temperature_target: Option<f64>,
/// within | at_or_below | at_or_above
#[serde(default)]
pub temperature_operator: Option<String>,
#[serde(default = "default_temporary_tolerance")]
pub tolerance_c: f64,
/// Continuous in-condition time required by temperature_stable.
#[serde(default)]
pub hold_seconds: u64,
/// Set only while the latest room samples continuously satisfy the condition.
#[serde(default)]
pub condition_started_at: Option<DateTime<Utc>>,
/// Optional fail-safe for temperature-based modes.
#[serde(default)]
pub safety_expires_at: Option<DateTime<Utc>>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TemporaryQuickThermostatRequest {
pub finish_kind: String,
#[serde(default)]
pub duration_minutes: Option<u64>,
#[serde(default)]
pub until: Option<DateTime<Utc>>,
#[serde(default)]
pub target_temperature: Option<f64>,
#[serde(default)]
pub temperature_operator: Option<String>,
#[serde(default)]
pub tolerance_c: Option<f64>,
#[serde(default)]
pub hold_minutes: Option<u64>,
#[serde(default)]
pub max_duration_minutes: Option<u64>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Zone {
pub id: String,
@@ -358,6 +409,11 @@ pub struct Zone {
/// the current group/schedule state is evaluated again.
#[serde(default)]
pub local_thermostat_resume_at: Option<DateTime<Utc>>,
/// Separate, user-defined temporary Quick Thermostat session. This is intentionally
/// independent from local_thermostat_resume_at, which belongs to the local-OFF
/// hand-back mechanism.
#[serde(default)]
pub temporary_quick_thermostat: Option<TemporaryQuickThermostat>,
/// True when the physical unit was changed outside the thermostat engine (for example by IR remote).
/// While active, normal zone/group/schedule automation observes the unit but does not overwrite it.
#[serde(default)]
@@ -463,6 +519,12 @@ pub struct ZoneControlPatch {
/// Return a locally forced quick thermostat to normal group/schedule ownership.
#[serde(default)]
pub clear_local_thermostat_override: Option<bool>,
/// Start or replace a temporary Quick Thermostat session.
#[serde(default)]
pub temporary_quick_thermostat: Option<TemporaryQuickThermostatRequest>,
/// Stop only the temporary Quick Thermostat session and return to automation.
#[serde(default)]
pub clear_temporary_quick_thermostat: Option<bool>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]