Improve Sonos polling (#51170)

* Improve Sonos polling

Warn user if polling is being used
Provide callback IP:port to help user fix networking
Fix radio handling when polling (no event payload)
Clarify dispatch target to reflect polling action

* Lint

* Revert method removal
This commit is contained in:
jjlawren 2021-05-28 05:07:58 -05:00 committed by GitHub
parent e45196f9c9
commit 39e62f9c90
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 35 additions and 17 deletions

View file

@ -293,13 +293,12 @@ class SonosMediaPlayerEntity(SonosEntity, MediaPlayerEntity):
return STATE_PLAYING
return STATE_IDLE
async def async_update(self, now: datetime.datetime | None = None) -> None:
async def async_update(self) -> None:
"""Retrieve latest state."""
await self.hass.async_add_executor_job(self._update, now)
await self.hass.async_add_executor_job(self._update)
def _update(self, now: datetime.datetime | None = None) -> None:
def _update(self) -> None:
"""Retrieve latest state."""
_LOGGER.debug("Polling speaker %s", self.speaker.zone_name)
try:
self.speaker.update_groups()
self.speaker.update_volume()