Move core Sonos functionality out of entities (#50277)

This commit is contained in:
jjlawren 2021-05-11 12:36:40 -05:00 committed by GitHub
parent 0fdc50408a
commit d6a202bd74
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 733 additions and 839 deletions

View file

@ -48,6 +48,9 @@ class SonosEntity(Entity):
self.async_write_ha_state,
)
)
async_dispatcher_send(
self.hass, f"{SONOS_ENTITY_CREATED}-{self.soco.uid}", self.platform.domain
)
@property
def soco(self) -> SoCo:
@ -76,14 +79,3 @@ class SonosEntity(Entity):
def should_poll(self) -> bool:
"""Return that we should not be polled (we handle that internally)."""
return False
class SonosSensorEntity(SonosEntity):
"""Representation of a Sonos sensor entity."""
async def async_added_to_hass(self) -> None:
"""Handle common setup when added to hass."""
await super().async_added_to_hass()
async_dispatcher_send(
self.hass, f"{SONOS_ENTITY_CREATED}-{self.soco.uid}", self.platform.domain
)