Files
localthings/tests
Marc Billow ad6c07a2a5 fix: keep last state on empty sweep reps; stop blocking the loop in diagnostics (#9)
Two fixes for issue #9 (WW90T634DHE washer):

- observe: a busy device (e.g. a washer mid-cycle) intermittently returns an
  empty/stub rep for a resource in the batch /device/0 sweep, which the batch
  parser surfaces as {}. apply_rep would then replace the cached fields with
  nothing, sending every entity on that resource -- the wash-setting and
  detergent/softener dosing selects -- to "unknown" until the next good sweep.
  A Samsung OCF resource never reports a genuinely empty state, so
  ObserveManager.apply now drops an empty rep when the cache already holds
  real data, keeping the last known-good value; a later sweep/notify with
  real fields updates it normally. A first-ever stub is still applied so the
  resource is known to exist.

- diagnostics: pkg_version("smartthings-local") reads the installed package's
  metadata off disk (listdir + open + read_text), tripping HA's event-loop
  blocking-call detector. Offload it to the executor. Audited the rest of the
  package: config_flow's socket/crypto work and every coordinator DTLS call
  are already offloaded via async_add_executor_job -- this was the only
  blocking call left on the loop.

Adds regression tests for both.
2026-07-21 15:12:00 +00:00
..