This commit is contained in:
Mateusz Gruszczyński
2026-08-24 15:20:29 +02:00
parent 4f70e36e89
commit 83f744e2cb
19 changed files with 744 additions and 176 deletions
+45
View File
@@ -1,3 +1,4 @@
use std::collections::BTreeMap;
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use serde_json::Value;
@@ -27,9 +28,13 @@ fn default_heat_comfort() -> f64 { 21.0 }
fn default_heat_sleep() -> f64 { 19.0 }
fn default_heat_away() -> f64 { 17.0 }
fn default_history_retention_days() -> u32 { 30 }
fn default_event_log_retention_days() -> u32 { 30 }
fn default_influx_version() -> String { "2".into() }
fn default_influx_database() -> String { "gree_controller".into() }
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 }
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Device {
@@ -409,6 +414,9 @@ pub struct HomeAssistantSettings {
/// Accept self-signed/expired certificates for local Home Assistant HTTPS.
#[serde(default)]
pub allow_invalid_tls: bool,
/// Friendly labels used only by the controller UI/charts; entity_id remains the storage key.
#[serde(default)]
pub sensor_aliases: BTreeMap<String, String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -465,6 +473,34 @@ pub struct DebugSettings {
pub gree_frames: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct NightModeSettings {
#[serde(default)]
pub enabled: bool,
#[serde(default = "default_night_start")]
pub start_time: String,
#[serde(default = "default_night_end")]
pub end_time: String,
/// Maximum fan speed used by thermostat control during night hours (1=Low..5=High).
#[serde(default = "default_night_max_fan_speed")]
pub max_fan_speed: u8,
/// Ask compatible GREE units to keep Quiet enabled during the whole night window.
#[serde(default = "default_true")]
pub force_quiet: bool,
}
impl Default for NightModeSettings {
fn default() -> Self {
Self {
enabled: false,
start_time: default_night_start(),
end_time: default_night_end(),
max_fan_speed: default_night_max_fan_speed(),
force_quiet: true,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ConfigurationExport {
pub format_version: u32,
@@ -528,6 +564,10 @@ pub struct ControlPlan {
pub house_mode: String,
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>,
@@ -554,6 +594,9 @@ pub struct RuntimeSettings {
pub history_retention_days: u32,
#[serde(default = "default_true")]
pub history_compaction_enabled: bool,
/// Retention window for controller event/debug log rows.
#[serde(default = "default_event_log_retention_days")]
pub event_log_retention_days: u32,
/// Add protocol-specific buzzer suppression fields to command frames.
#[serde(default)]
pub suppress_device_beep: bool,
@@ -561,6 +604,8 @@ pub struct RuntimeSettings {
pub influxdb: InfluxDbSettings,
#[serde(default)]
pub debug: DebugSettings,
#[serde(default)]
pub night_mode: NightModeSettings,
pub home_assistant: HomeAssistantSettings,
}