Repository navigation
Conversation
Every poll re-wrote every state through json2iob, so each subscriber received an update for every value on every poll even when nothing changed (a KH100 with nine KE100s: ~340 updates a minute). json2iob now writes through setStateChanged. json2iob's own previousData option can't be used here: it looks list entries up by the named path it generates, which doesn't exist in the previous payload, so every child of a hub's child list would still count as changed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Polls now publish a value only when it has changed. json2iob writes through
setStateChangedAsyncinstead ofsetStateAsync, via a thin wrapper around the adapter that is passed tonew Json2iob(...). Nothing else changes.Why
Every poll re-wrote every state, so every subscriber received an update for every value on every poll, even when nothing had changed. With a KH100 hub and nine KE100 TRVs plus one P110, that was about 340 state updates a minute. Each TRV produced 35 updates a minute while its readings stayed the same.
That traffic reaches everything subscribed to the states: VIS and other UIs, scripts with
on({ id })withoutchange: 'ne', aliases, and cloud relays. The ioBroker.cloud free tier blocks the account for "too many events" because of it.Measured from a UI subscribed to the TRV and plug aliases, over 60 seconds:
Why not json2iob's
previousDataoptionjson2iob has a
previousDataoption for this, but it doesn't work for list payloads such as a hub'schild_device_list. json2iob names list entries (by nickname, ID and so on) when it builds the state path._hasValueChangedthen looks that named path up in the previous payload, where the entries are still array indexes. The lookup never matches, so every child value counts as changed and is written anyway. Comparing against the stored state withsetStateChangedavoids the problem. It also corrects a state after a command the device didn't apply, because the next poll's value differs from theack: falsevalue the user wrote.Notes
setStatecalls are unchanged, includingconnected,motionEvent,ringEventand the remotes, so events still fire every time.active,eventCount, the event list) are level values that change with every new event, so they still update.tsno longer advances for values that don't change.lcwas already only set on change.Testing
npm run lint, type check,build-adapter ts, andnpm test(44 passing).Zusammenfassung (DE)
Beim Polling werden jetzt nur noch geänderte Werte geschrieben: json2iob schreibt über
setStateChangedAsyncstattsetStateAsync. Bisher wurde bei jedem Poll jeder State neu gesetzt. Mit einem KH100 und neun KE100 waren das rund 340 Updates pro Minute an alle Abonnenten (VIS, Skripte, Aliase, Cloud). Gemessen sinkt das von 307 auf 30 pro Minute. Die json2iob-OptionpreviousDatafunktioniert für Listen wiechild_device_listnicht, weil die benannten Pfade im vorherigen Payload nie gefunden werden. DirektesetState-Aufrufe (z. B.motionEvent,ringEvent,connected) bleiben unverändert.🤖 Generated with Claude Code