Skip to content

Commit

Permalink
Update media_player.py
Browse files Browse the repository at this point in the history
  • Loading branch information
aunefyren committed Jan 31, 2024
1 parent d130f39 commit 8433850
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions custom_components/bluesound_alt/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,30 +272,32 @@ async def force_update_sync_status(self, on_updated_cb=None, raise_timeout=False
master_host = master.get("#text")
master_port = master.get("@port", "11000")
master_id = f"{master_host}:{master_port}"
master_device = None

# Find device
for device in self._hass.data[DATA_BLUESOUND]:
if device.id == master_id:
self._master = device
master_device = device

# Error if master is not found
if self._master is None:
_LOGGER.error("Master not found %s", master_id)

# New group for master
new_device_group = []
new_device_group.append(self._master.entity_id)
new_device_group.append(master_device.entity_id)

# Call to get slaves for master
resp_two = await self.send_bluesound_command(
"SyncStatus", raise_timeout, raise_timeout
)

self._master._sync_status = resp_two["SyncStatus"].copy()
master_device._sync_status = resp_two["SyncStatus"].copy()

if self._master.sync_status["SyncStatus"]["slave"] != None:
if master_device._sync_status["SyncStatus"]["slave"] != None:
# Extract information from slave objects
slave_objects = self._master._sync_status["SyncStatus"].get('slave', [])
slave_objects = master_device._sync_status["SyncStatus"].get('slave', [])
if isinstance(slave_objects, list):
# Multiple slave objects
for slave_obj in slave_objects:
Expand Down

0 comments on commit 8433850

Please sign in to comment.