Fix vanished checks on old Sonos firmware (#65477)

This commit is contained in:
jjlawren 2022-02-03 06:22:34 -06:00 committed by Paulus Schoutsen
parent d195e8a1b4
commit 8d33964e4d

View File

@ -701,7 +701,7 @@ class SonosSpeaker:
"""Handle callback for topology change event."""
if xml := event.variables.get("zone_group_state"):
zgs = ET.fromstring(xml)
for vanished_device in zgs.find("VanishedDevices"):
for vanished_device in zgs.find("VanishedDevices") or []:
if (reason := vanished_device.get("Reason")) != "sleeping":
_LOGGER.debug(
"Ignoring %s marked %s as vanished with reason: %s",