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(iobroker): stream energy live_status/site_info in default streaming mode (#115)
* fix(iobroker): stream energy live_status/site_info in default streaming mode
Energy data was fetched once at startup and then never updated when
streaming was enabled (the default), since StreamHandler only listened
to vehicle topics. Register live_status/site_info listeners alongside
the existing vehicle ones and route them through the same flat energy
parser used by the REST seed, so energy states keep updating from the
stream instead of freezing after the initial fetch.
* fix(iobroker): ignore energy stream events for unregistered sites
live_status/site_info arrive on the account-level stream for every
accessible site, not just the ones this adapter instance selected -
without a check, an unselected site's events wrote to object paths
that were never created. Filter both handlers against
EnergyHandler.getRegisteredSites() before forwarding to the parser.
* fix(iobroker): seed energy state before opening the SSE stream
streamHandler.connect() only starts the SDK's background reconnect
loop and returns immediately, so the previous ordering let a
live_status/site_info event land before the initial energy REST
fetch resolved - the fetch would then overwrite it with a stale
snapshot. Fetch energy state first, then open the stream.
Consume `live_status`/`site_info` SSE events per energy site so energy data keeps updating in the default streaming mode, instead of freezing after the initial startup fetch. The REST fetch still seeds a deterministic initial value; the stream now keeps it current afterward without polling.
test('energy live values change after the REST startup seed via live_status stream events, without polling (regression: default streaming mode left energy frozen after startup)',async()=>{
test('live_status events for an unselected/unregistered energy site are ignored (regression: account-level stream delivers every accessible site, not just the ones this instance registered)',async()=>{
0 commit comments