v0.3.5
This commit is contained in:
+22
-2
@@ -4,7 +4,7 @@ use serde_json::Value;
|
||||
|
||||
fn default_true() -> bool { true }
|
||||
fn default_port() -> u16 { 7000 }
|
||||
fn default_protocol() -> u8 { 1 }
|
||||
fn default_protocol() -> u8 { 0 }
|
||||
fn default_mode() -> String { "cool".into() }
|
||||
fn default_fan() -> u8 { 0 }
|
||||
fn default_target() -> f64 { 24.0 }
|
||||
@@ -65,6 +65,8 @@ pub struct Device {
|
||||
pub last_seen: Option<DateTime<Utc>>,
|
||||
#[serde(default)]
|
||||
pub last_error: Option<String>,
|
||||
#[serde(default)]
|
||||
pub communication_failures: u8,
|
||||
pub created_at: DateTime<Utc>,
|
||||
pub updated_at: DateTime<Utc>,
|
||||
}
|
||||
@@ -99,6 +101,7 @@ impl Device {
|
||||
online: true,
|
||||
last_seen: Some(now),
|
||||
last_error: None,
|
||||
communication_failures: 0,
|
||||
created_at: now,
|
||||
updated_at: now,
|
||||
}
|
||||
@@ -132,7 +135,7 @@ impl DeviceCommand {
|
||||
pub fn apply(&self, device: &mut Device) {
|
||||
if let Some(v) = self.power { device.power = v; }
|
||||
if let Some(v) = &self.mode { device.mode = v.clone(); }
|
||||
if let Some(v) = self.target_temperature { device.target_temperature = v.clamp(8.0, 32.0); }
|
||||
if let Some(v) = self.target_temperature { device.target_temperature = v.clamp(8.0, 30.0); }
|
||||
if let Some(v) = self.fan_speed { device.fan_speed = v.min(5); }
|
||||
if let Some(v) = self.swing_vertical { device.swing_vertical = v; }
|
||||
if let Some(v) = self.swing_horizontal { device.swing_horizontal = v; }
|
||||
@@ -192,6 +195,17 @@ pub struct Zone {
|
||||
|
||||
fn default_sensor_source() -> String { "device".into() }
|
||||
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
|
||||
pub struct ZoneControlPatch {
|
||||
#[serde(default)]
|
||||
pub setpoint: Option<f64>,
|
||||
#[serde(default)]
|
||||
pub mode: Option<String>,
|
||||
#[serde(default)]
|
||||
pub enabled: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct Schedule {
|
||||
pub id: String,
|
||||
@@ -284,6 +298,12 @@ pub struct DiscoveryRequest {
|
||||
pub timeout_ms: Option<u64>,
|
||||
#[serde(default)]
|
||||
pub broadcast: Option<String>,
|
||||
/// 0 = auto (accept both), 1 = AES-ECB only, 2 = AES-GCM only.
|
||||
#[serde(default)]
|
||||
pub protocol_version: Option<u8>,
|
||||
/// Number of scan broadcasts sent during one discovery operation.
|
||||
#[serde(default)]
|
||||
pub passes: Option<u8>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
|
||||
Reference in New Issue
Block a user