Use compressed entity changes for device controls #2942
Merged
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.
Summary
This PR adds support for the
subscribe_entities
websocket subscription which delivers state + changes in a compressed format to reduce data usage, supposedly by 35-90% depending on the message.Device controls have been updated to use the new subscription on supported Home Assistant versions.
Because
subscribe_entities
combines initial states + state changes in a single subscription, it is not a drop-in replacement for existing entity state changes subscribers, as those only deliver changes. Because the app re-uses subscriptions with the same request message users also have to be mindful of potential re-use, as they may not get the initial states if they are not the first subscriber.Screenshots
n/a
Link to pull request in Documentation repository
n/a
Any other notes
Testing note: I don't think the limitations mentioned in the last paragraph above apply here; the code has been updated to handle initial states and changes in one subscription, and there should only be one subscription active at a time. During testing I was only able to get it to stop working once, but that was before the recent changes to subscriptions that use a Channel to buffer messages. Still, please do try getting it into weird states!