This commit is contained in:
Mateusz Gruszczyński
2026-09-03 10:26:18 +02:00
parent 8f6169fbe3
commit 4c9f8ff403
31 changed files with 673 additions and 71 deletions
+13
View File
@@ -1,4 +1,17 @@
impl GreeClient {
/// Measure a minimal GREE round-trip without mutating persisted/live device state.
/// Diagnostics must not alter online/error counters, ownership, readings or capabilities.
pub async fn probe(&self, device: &Device) -> Result<u64> {
if device.simulated { return Ok(0); }
let key = device.key.as_deref().filter(|value| !value.is_empty())
.ok_or_else(|| anyhow!("device is not bound"))?;
let started = Instant::now();
let response = self.status_request(device, key, &["Pow"]).await?;
let mut snapshot = device.clone();
self.apply_status(&mut snapshot, &response)?;
Ok(started.elapsed().as_millis().min(u64::MAX as u128) as u64)
}
pub async fn poll(&self, device: &mut Device) -> Result<()> {
let key = device.key.clone().ok_or_else(|| anyhow!("device is not bound"))?;
let full_cols = [