You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(homebridge): surface terminal stream health instead of staying silently stale (#116)
* fix(homebridge): surface terminal stream health instead of staying silently stale
Handle stream_error and terminal auth_failure from the account SSE stream:
correct the disconnect log (it no longer claims a reconnect is coming, since
after two consecutive auth failures the SDK stops for good), mark every
contact sensor that supports a HomeKit fault state (doors, TPMS, grid
outage, storm watch active) as faulted on terminal failure, and clear it on
the next successful connect. Core service types without an honest fault
characteristic (Lock, Switch, Thermostat, Battery) are left alone rather
than forcing an out-of-spec characteristic onto them.
* fix(homebridge): clear stream fault per-service on real data, not on bare connect
TeslemetryStream emits "connect" before consuming any SSE event, so clearing
StatusFault there showed last-known (possibly stale/default) sensor state as
healthy again with no proof fresh data had actually arrived. Each faulted
service now clears its own StatusFault only when it receives a real reading,
matching the existing "unknown/faulted until a real payload lands" pattern
already used for TPMS/grid-outage/storm-watch. DoorService didn't touch
StatusFault on data at all; it now does.
* fix(homebridge): fault lazily-created Wall Connector sensors on terminal stream failure
WallConnectorService doesn't extend BaseEnergyService (its per-DIN sensors
are created lazily), so it had no setStreamFault() and EnergyAccessory's
duck-typed fault fan-out silently skipped it - already-discovered Wall
Connector sensors kept their last cable/fault state forever instead of
reporting GENERAL_FAULT like the other stream-backed contact sensors.
Adds setStreamFault(), clearing each DIN's fault only when a fresh
live_status reading for that DIN actually arrives.
* fix(homebridge): clear StatusFault generically wherever subscribeSignal delivers real data
RearDefrostService is a ContactSensor driven entirely through the generic
subscribeSignal() path, which only ever updated the mapped characteristic -
unlike Door/TPMS/GridOutage/StormWatch, nothing cleared its StatusFault, so
once a terminal auth failure faulted it, it would stay GENERAL_FAULT forever
even after receiving current data. Clearing the fault inside subscribeSignal
itself (a no-op for service types without StatusFault) fixes this for
RearDefrost and any future ContactSensor service that uses the generic path.
Handle `stream_error` and terminal `auth_failure` from the account stream: a stream disconnect no longer logs a blanket "will attempt to reconnect" (it may be terminal), and two consecutive auth failures now mark every contact sensor that supports a HomeKit fault state (doors, TPMS, grid outage, storm watch active) as faulted instead of leaving them on their last cached value forever. A later reconnect clears the fault. See the README's Streaming Connection Issues section for recovery steps.
Copy file name to clipboardExpand all lines: AGENTS.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -149,6 +149,8 @@ pnpm link --global n8n-nodes-teslemetry
149
149
150
150
**Gotcha**: not every feature can be gated ahead of time (model/config are known synchronously; whether a given vehicle *reports* a signal at all often isn't). `PresenceService` (`vehicle-services/presence.ts`) and `WallConnectorService` (`energy-services/wall-connector.ts`) don't extend `BaseService`/`BaseEnergyService` and create zero HAP services at construction time - each sub-sensor (per presence field, per Wall Connector DIN) is created lazily the first time its signal/live_status entry actually arrives, since a field withheld by scope or simply absent hardware may never fire. Contrast this with `TpmsService`, `GridOutageService`, and `StormWatchActiveService`, which construct their `ContactSensor`s eagerly (virtually every vehicle/site has the underlying hardware) but hold `StatusFault` at `GENERAL_FAULT` until the first real payload lands, clearing it only then - never default a not-yet-received reading to "safe" by leaving a fresh `ContactSensorState` at its HAP default. Both new and existing contact-sensor mappings in this package (`DoorService`, the TPMS/grid/storm/wall-connector services above) follow one polarity convention: `CONTACT_DETECTED` = normal/quiescent (door closed, no fault, cable seated, grid up), `CONTACT_NOT_DETECTED` = triggered/abnormal (door open, fault active, cable unseated, grid down) - keep new contact sensors on this convention rather than picking polarity per-service.
151
151
152
+
**Gotcha**: `BaseService`/`BaseEnergyService.setStreamFault()` (called from `VehicleAccessory`/`EnergyAccessory`/`TeslemetryPlatform` to reflect terminal account-stream health) only marks a service's `StatusFault` when that HomeKit service type actually declares it as an optional characteristic (checked via `service.optionalCharacteristics`, not `service.testCharacteristic()` - the latter only reports characteristics already added, which excludes `StatusFault` on a service like `DoorService` that never touches it during normal operation). Only sensor-type services (`ContactSensor` and similar) declare `StatusFault` at all; core control services (`LockMechanism`, `Switch`, `Thermostat`, `Battery`) don't, and forcing it onto them via `getCharacteristic()` would silently add an out-of-spec characteristic with a HAP warning - `setStreamFault()` is a no-op for those rather than inventing a misleading fault signal. Services owning more than one HAP `Service` instance (`TpmsService`, `DoorService`) override `setStreamFault()` to loop over all of them, not just the primary `this.service`.
0 commit comments