feat(telemetry): broadcast door hardware state transitions as a first-class event #55
Labels
No labels
blocked
bug
enhancement
high-priority
low-priority
needs-info
needs-triage
ready-for-agent
ready-for-human
referenced
research
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gabogg/hikcentral#55
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Spun out of #14 Candidate 2 during the grilling session of 2026-09-22.
Problem
Door hardware contact transitions are persisted but never broadcast. The table
door_hardware_state_transitionsis created atapp/db/database.py:276and written atapp/db/door_repository.py:486,:527,:577,:596— but no WebSocket message type carries them.monitor_service.pyemits three message types today:doors_update(:110-119,:32-42),occupancy_update(:45-52) andtelemetry(:145-157). A client wanting contact transitions has to infer them by diffing successivedoors_updateoverviews, which loses any transition that occurs between two polls.Why it was split out
#14 bundled this with the streaming-seam deepening under a
DoorStateTransitionevent type. It is not a deepening — the existing broadcast is not wrong about transitions, it simply does not carry them. This is a new capability and should be scoped and tested as one.Suggested approach
DoorStateTransitionDTO (no equivalent exists inapp/schemas/; contrastPassengerFlowEventatoccupancy_models.py:234, which already covers the passage case).doors_updateor gets its own message type — the client'shandleIncomingWsMessage(app/static/js/app.js:511) andTelemetryEngine.ingestMessageboth switch ontype.Acceptance criteria
DoorStateTransitionDTO defined with the fields the table persists.door_hardware_state_transitionsproduces exactly one broadcast.🤖 Generated with Claude Code
Triage resolution — 2026-09-23
This resolution supersedes conflicting original acceptance criteria.
A door state transition is a persisted change between door states, including
physical open/close changes, commanded states and offline/recovery changes.
Do not describe every state change as a physical contact movement.
Deliver live updates with current-state resynchronization on reconnect. Recovery
of all transitions missed during disconnection is outside the initial scope;
there is no exactly-once browser-delivery guarantee. Current-state initialization
already exists on WebSocket connection and must be retained.
Acceptance:
previous/new state, timestamp, source and exclusion metadata.
reconciliation. Services own emission after successful persistence;
repositories remain persistence-only. Avoid duplicate emissions by callers.
emission attempt. An emission attempt is not a delivery acknowledgment.
them excluded from activity streams and rankings under existing rules.
details_json; person namesand card numbers remain in existing access-cycle messages.
overview snapshots for initialization, reconnect and derived metadata.
commanded and excluded-door transitions, failed persistence, duplicate
emission prevention and reconnect snapshots.