v0.11.6
This commit is contained in:
@@ -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 = [
|
||||
|
||||
Reference in New Issue
Block a user