This commit is contained in:
Mateusz Gruszczyński
2026-08-24 00:23:47 +02:00
parent 6e3075fae5
commit 10bc9aa099
21 changed files with 1110 additions and 260 deletions
+26 -5
View File
@@ -217,6 +217,7 @@ impl GreeClient {
light: true,
current_temperature: None,
outdoor_temperature: None,
temperature_sensor_offset: None,
online: true,
last_seen: Some(now),
last_error: None,
@@ -302,14 +303,23 @@ impl GreeClient {
"TemRec","SvSt","TemSen","CoolSvTem","HeatSvTem","OutEnvTem"
];
let core_cols = ["Pow","Mod","SetTem","TemRec","TemUn","TemSen","WdSpd","Lig","SwingLfRig","SwUpDn","Quiet","Tur"];
let response = match self.status_request(device, key, &full_cols).await {
Ok(value) => value,
let (response, used_core_fallback) = match self.status_request(device, key, &full_cols).await {
Ok(value) => (value, false),
Err(first) => {
tracing::debug!(device=%device.id, error=?first, "Full GREE status request failed; retrying core properties");
self.status_request(device, key, &core_cols).await?
(self.status_request(device, key, &core_cols).await?, true)
}
};
self.apply_status(device, &response)?;
// Some firmware rejects a large mixed property list but still exposes OutEnvTem.
// Probe it separately after the core fallback so compatible units can contribute
// their outdoor sensor to history without making the main poll fail.
if used_core_fallback {
match self.status_request(device, key, &["OutEnvTem"]).await {
Ok(optional) => { let _ = self.apply_status(device, &optional); }
Err(err) => tracing::trace!(device=%device.id, error=?err, "GREE outdoor temperature is not available"),
}
}
device.online = true;
device.communication_failures = 0;
device.last_seen = Some(Utc::now());
@@ -343,11 +353,22 @@ impl GreeClient {
"Lig" => device.light = value_as_i64(value) != 0,
"TemSen" => {
let raw = value_as_f64(value);
device.current_temperature = Some(if raw > 40.0 { raw - 40.0 } else { raw });
// The room sensor is a useful discriminator because normal indoor
// temperatures cannot exceed 40 C in controller operation. Persist
// the detected wire format and reuse it for OutEnvTem, including
// sub-zero outdoor values encoded as (temperature + 40).
if raw != 0.0 {
let offset = raw > 40.0;
device.temperature_sensor_offset = Some(offset);
device.current_temperature = Some(if offset { raw - 40.0 } else { raw });
}
}
"OutEnvTem" => {
let raw = value_as_f64(value);
device.outdoor_temperature = Some(if raw > 40.0 { raw - 40.0 } else { raw });
if raw != 0.0 {
let offset = device.temperature_sensor_offset.unwrap_or(raw > 50.0);
device.outdoor_temperature = Some(if offset { raw - 40.0 } else { raw });
}
}
_ => {}
}