Widgets: use received entity state changes for updating if possible #2089
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
Currently, any time an entity state change is received (via the websocket) all widgets data is refreshed and views are updated. While it works to keep the widgets 'live', it is very inefficient, especially if there are a lot of state changes and/or you have a lot of widgets.
This PR proposes a way to use the entity state changes the app already receives to update the widgets more efficiently, specifically:
*Right now that is just the entity state and media player widgets. The template widget is rendered on the server which might be affected by state changes in ways we don't know anything about, so just keep refreshing that as before.
Screenshots
No visible changes
Link to pull request in Documentation repository
Doesn't seem necessary
Any other notes