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 30, 2024
1 parent 4c96844 commit 9a20bf8
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions custom_components/bluesound_alt/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -880,11 +880,19 @@ async def rebuild_bluesound_group(self):
)

slaves = []
for key in sync_status["SyncStatus"]:
_LOGGER.debug("KEY: %s", key)

for slave in slaves:
new_device_group.append(slave.id + ":" + slave.port)
# Extract information from slave objects
slave_objects = sync_status["SyncStatus"].get('slave', [])
if isinstance(slave_objects, list):
for slave_obj in slave_objects:
slave_id = slave_obj['@id']
slave_port = slave_obj['@port']
slaves.append(slave_id + ":" + slave_port)
elif slave_objects != None:
# Single slave object
slave_id = slave_objects['@id']
slave_port = slave_objects['@port']
slaves.append(slave_id + ":" + slave_port)
else:
_LOGGER.debug("Device is a slave: %s", new_device_group)

Expand Down

0 comments on commit 9a20bf8

Please sign in to comment.