Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions homeassistant/components/sonos/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,16 @@ def __init__(self, player):
async def async_added_to_hass(self):
"""Subscribe sonos events."""
await self.async_seen()

self.hass.data[DATA_SONOS].entities.append(self)

def _rebuild_groups():
"""Build the current group topology."""
for entity in self.hass.data[DATA_SONOS].entities:
entity.update_groups()

self.hass.async_add_executor_job(_rebuild_groups)

@property
def unique_id(self):
"""Return a unique ID."""
Expand Down Expand Up @@ -469,10 +477,6 @@ def _attach_player(self):
self.update_volume()
self._set_favorites()

# New player available, build the current group topology
for entity in self.hass.data[DATA_SONOS].entities:
entity.update_groups()

player = self.soco

def subscribe(service, action):
Expand Down