Streamline setup of deCONZ button platform#70593
Conversation
Co-authored-by: J. Nick Koston <nick@koston.org>
|
|
||
| async_add_scene() | ||
| for scene_id in gateway.api.scenes: | ||
| async_add_scene(EventType.ADDED, scene_id) |
There was a problem hiding this comment.
If there will ever be a lot of scenes at startup....you could make async_add_scene a wrapper around new async_add_scenes and accept multiple so you only call async_add_entities once with all the entities
There was a problem hiding this comment.
Is it that big of a deal for upstart? I'm not questioning your reasoning but Id really like to understand what you're suggesting
There was a problem hiding this comment.
Every time you call async_add_entities its going to call https://github.com/home-assistant/core/blob/dev/homeassistant/helpers/entity_platform.py#L326 which creates a task in the event loop.
If you had 100s of scenes (hopefully someone doesn't actually have that many), this can start to add up quickly
There was a problem hiding this comment.
I can't say for other users. But I could definitely see myself using maybe 4 scenes per group that are relevant to control over various times of the day. So maybe at least 40 scenes would be expected.
There was a problem hiding this comment.
Thanks! I will consider this going forward
Breaking change
Proposed change
Utilise the improvements from refactoring pydeconz to stream line platform setup.
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.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: