This commit is contained in:
Mateusz Gruszczyński
2026-08-27 22:58:13 +02:00
parent b93a1f2d92
commit 6572ff368b
19 changed files with 398 additions and 51 deletions
+39
View File
@@ -14,6 +14,7 @@ fn default_external_sensor_weight() -> f64 { 0.4 }
fn default_max_sensor_difference() -> f64 { 3.0 }
fn default_control_temperature_source() -> String { "device".into() }
fn default_min_cycle() -> u64 { 180 }
fn default_sensor_stale_after() -> u64 { 300 }
fn default_cooldown() -> u64 { 300 }
fn default_house_mode() -> String { "cool".into() }
fn default_control_strategy() -> String { "setpoint".into() }
@@ -322,6 +323,9 @@ pub struct Zone {
/// If GREE and external sensor differ more than this, the controller falls back to GREE.
#[serde(default = "default_max_sensor_difference")]
pub max_sensor_difference: f64,
/// Maximum accepted age of a Home Assistant room sensor sample.
#[serde(default = "default_sensor_stale_after")]
pub sensor_stale_after_seconds: u64,
/// Temperature reported by the GREE indoor sensor during the last zone cycle.
#[serde(default)]
pub device_temperature: Option<f64>,
@@ -369,6 +373,29 @@ pub struct Zone {
/// It lets us drop a stale "resume automation" prompt when the user restores that state.
#[serde(default)]
pub device_manual_override_baseline: Option<ManualDeviceBaseline>,
/// Monotonic configuration/control revision used for optimistic concurrency.
#[serde(default)]
pub revision: u64,
/// Normalized control ownership exposed consistently to API/Web/Home Assistant.
#[serde(default)]
pub control_owner: String,
#[serde(default)]
pub control_source: String,
#[serde(default)]
pub control_since: Option<DateTime<Utc>>,
#[serde(default)]
pub control_resume_at: Option<DateTime<Utc>>,
#[serde(default)]
pub control_reason: String,
/// Last physical power/mode transition timestamps used by compressor lockout.
#[serde(default)]
pub last_power_change_at: Option<DateTime<Utc>>,
#[serde(default)]
pub last_mode_change_at: Option<DateTime<Utc>>,
#[serde(default)]
pub lockout_until: Option<DateTime<Utc>>,
#[serde(default)]
pub lockout_reason: Option<String>,
#[serde(default)]
pub effective_mode: String,
#[serde(default)]
@@ -739,6 +766,11 @@ pub struct ZoneControlPlan {
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>>,
@@ -746,6 +778,13 @@ pub struct ZoneControlPlan {
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>,