-
-
Notifications
You must be signed in to change notification settings - Fork 29.3k
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
Clean up Light Groups #12962
Clean up Light Groups #12962
Conversation
@@ -79,10 +79,11 @@ def async_state_changed_listener(entity_id: str, old_state: State, | |||
|
|||
self._async_unsub_state_changed = async_track_state_change( | |||
self.hass, self._entity_ids, async_state_changed_listener) | |||
self.async_schedule_update_ha_state(True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should just call await self.async_update()
here, updating state is done right after the call to async_added_to_hass
: https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/helpers/entity_platform.py#L257-L260
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, thanks.
* Add Light Group platform docs * Group Light →Light Group * A picture tells a thousand words * Update for Light Group default name change. See home-assistant/core#12962
Putting this in the 0.65 milestone because the merged docs have the updated default name "Light Group". |
* Add Light Group platform docs * Group Light →Light Group * A picture tells a thousand words * Update for Light Group default name change. See home-assistant/core#12962
* Clean up Light Groups * Fix tests * Remove light group from .coveragerc * async_schedule_update_ha_state called anyway
Description:
async_add_devices
toasync_added_to_hass
(Fix flaky light group test #12843 (comment)); The former does theasync_update
before we register our callback. Theoretically it could happen that a state is published between whenadd_devices
when our subscription is established. Then we would miss a state..coveragerc
. I didn't know what that file did when doing the initial PR.Related PR (if applicable): #12229
Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#4739
Example entry for
configuration.yaml
(if applicable):Checklist:
If the code does not interact with devices:
tox
run successfully. Your PR cannot be merged unless tests pass