-
-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce overhead to update esphome entities #94930
Conversation
Hey there @OttoWinter, @jesserockz, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
Reflashed a few to make sure the behavior is the same |
|
thanks |
Proposed change
Reduce overhead to update esphome entities
There were lots of property/attrs lookups for static info values that rarely change. We can update the attrs when we get the dispatch instead.
I also changed the recently added
_on_static_info_update
to dispatch indexed bycomponent_key
andkey
to avoid the pattern where each entity has to reject the dispatch if it doesn't match thekey
I did
sensor
first since power sensors are usually one or two orders of magnitude more updates than anything else. I also didbinary_sensor
to make sure the pattern would work beyond just sensor since it was the simplest platform to modify and it had special cases for the connected sensorAlso pickup codeowner for
esphome
to make sure this doesn't have any unexpected fallout and since I've been working through a lot of the esphome issues in the queue anyways.Type of change
Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.To help with the load of incoming pull requests: