Skip Sonos zeroconf availability check in non-timeout scenarios (#54425)

This commit is contained in:
jjlawren 2021-08-13 15:42:55 -05:00 committed by GitHub
parent 8264fd2eb6
commit f4fb5f2f5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -499,12 +499,17 @@ class SonosSpeaker:
self.async_write_entity_states()
async def async_unseen(self, now: datetime.datetime | None = None) -> None:
async def async_unseen(
self, callback_timestamp: datetime.datetime | None = None
) -> None:
"""Make this player unavailable when it was not seen recently."""
if self._seen_timer:
self._seen_timer()
self._seen_timer = None
if callback_timestamp:
# Called by a _seen_timer timeout, check mDNS one more time
# This should not be checked in an "active" unseen scenario
hostname = uid_to_short_hostname(self.soco.uid)
zcname = f"{hostname}.{MDNS_SERVICE}"
aiozeroconf = await zeroconf.async_get_async_instance(self.hass)