Fix referenced before assignment error in sonos speaker (#57924)

This commit is contained in:
Robert Hillis
2021-10-20 11:44:08 -04:00
committed by GitHub
parent 9a58bfdf41
commit d20936d175

View File

@@ -528,7 +528,7 @@ class SonosSpeaker:
) -> None:
"""Make this player unavailable when it was not seen recently."""
data = self.hass.data[DATA_SONOS]
if callback_timestamp and (zcname := data.mdns_names.get(self.soco.uid)):
if (zcname := data.mdns_names.get(self.soco.uid)) and callback_timestamp:
# Called by a _seen_timer timeout, check mDNS one more time
# This should not be checked in an "active" unseen scenario
aiozeroconf = await zeroconf.async_get_async_instance(self.hass)