Skip to content

Subsystem 4e: Per-device unreachable status (switches/alarms/storage, inline)#36

Merged
HandyS11 merged 11 commits into
developfrom
feat/unreachable-devices
Jun 30, 2026
Merged

Subsystem 4e: Per-device unreachable status (switches/alarms/storage, inline)#36
HandyS11 merged 11 commits into
developfrom
feat/unreachable-devices

Conversation

@HandyS11

Copy link
Copy Markdown
Owner

Subsystem 4e — Per-Device Unreachable Status

Adds a persisted, three-way per-device reachability axis to the three managed smart-device types — switches, alarms, storage monitors — surfaced inline on each device's embed.

DeviceReachability: Reachable · Removed (entity destroyed — not_found) · NoPrivilege (token lost building access — access_denied) · NoResponse (timeout / other).

How it works

  • MapReachabilityMapping.FromResponse translates RustPlusErrorCodeDeviceReachability (sealed inside Features.Connections; the protocol enum never leaks past it).
  • Seam — device reads now return DeviceReading/StorageReading (payload + reachability); switch actuation returns DeviceReachability.
  • Detect — connect-prime publishes a DeviceReachabilityChangedEvent per device; a periodic PollReachabilityAsync loop publishes on change (ReachabilityPollInterval, default 5 min); switch actuation publishes on failure. Also fixes a latent prime bug where a removed switch/alarm was silently primed as "off".
  • PersistReachability column on the three entities (migration DeviceReachability, additive, default Reachable).
  • Surface — each feature relay persists + re-renders (ownership-filtered by entity id); renderers show the reason inline and gate controls (Removed/NoPrivilege disable; NoResponse stays enabled — likely transient). Switch actuation replies with the localized reason and updates the embed. EN/FR throughout.

Verification

  • 739 tests across 16 assemblies green; build -warnaserror with 0 warnings; jb cleanupcode --profile=ReformatAndReorder clean; localization parity 248 → 260 (+12 EN/FR keys).

Notes

  • Inline-only — no #unreachable-devices channel — per the catalog's C3/C4 "prefer inline status, keep a channel only if it earns it".
  • Does not fully close subsystem 4 — switch groups (4d) remains unbuilt.
  • Known follow-up (deferred, non-blocking): a storage monitor recovering reachability mid-session briefly re-renders "unreachable" with Refresh disabled until the next contents trigger — storage has no persisted contents to recover from, unlike switches/alarms (which recover from LastIsActive). The naive fix would wrongly enable Refresh during a real server-down, so the correct fix (relay re-fetches contents on recovery) is worth its own small slice.

🤖 Generated with Claude Code

@HandyS11 HandyS11 merged commit ca715ac into develop Jun 30, 2026
3 checks passed
@HandyS11 HandyS11 deleted the feat/unreachable-devices branch June 30, 2026 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant