From 6ba49e12a261fcd02bcfd4eafaed7e5d2879d857 Mon Sep 17 00:00:00 2001 From: Anders Melchiorsen Date: Wed, 16 May 2018 07:35:43 +0200 Subject: [PATCH] Improve handling of offline Sonos devices (#14479) --- homeassistant/components/media_player/sonos.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/media_player/sonos.py b/homeassistant/components/media_player/sonos.py index cc10355abe8..06e5f3befe4 100644 --- a/homeassistant/components/media_player/sonos.py +++ b/homeassistant/components/media_player/sonos.py @@ -682,11 +682,15 @@ class SonosDevice(MediaPlayerDevice): if group: # New group information is pushed coordinator_uid, *slave_uids = group.split(',') - else: + elif self.soco.group: # Use SoCo cache for existing topology coordinator_uid = self.soco.group.coordinator.uid slave_uids = [p.uid for p in self.soco.group.members if p.uid != coordinator_uid] + else: + # Not yet in the cache, this can happen when a speaker boots + coordinator_uid = self.unique_id + slave_uids = [] if self.unique_id == coordinator_uid: sonos_group = []