Centralize storage and updating of Sonos favorites (#50581)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
parent
224cc779c4
commit
b84cf915f3
6 changed files with 127 additions and 23 deletions
|
@ -16,6 +16,7 @@ from .const import (
|
|||
DOMAIN,
|
||||
SONOS_ENTITY_CREATED,
|
||||
SONOS_ENTITY_UPDATE,
|
||||
SONOS_HOUSEHOLD_UPDATED,
|
||||
SONOS_STATE_UPDATED,
|
||||
)
|
||||
from .speaker import SonosSpeaker
|
||||
|
@ -48,6 +49,13 @@ class SonosEntity(Entity):
|
|||
self.async_write_ha_state,
|
||||
)
|
||||
)
|
||||
self.async_on_remove(
|
||||
async_dispatcher_connect(
|
||||
self.hass,
|
||||
f"{SONOS_HOUSEHOLD_UPDATED}-{self.soco.household_id}",
|
||||
self.async_write_ha_state,
|
||||
)
|
||||
)
|
||||
async_dispatcher_send(
|
||||
self.hass, f"{SONOS_ENTITY_CREATED}-{self.soco.uid}", self.platform.domain
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue