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 02365d4 commit 8f01db4
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions custom_components/bluesound_alt/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -874,13 +874,14 @@ async def rebuild_bluesound_group(self):
new_device_group = []

if self.is_master:
new_device_group.append(self)
# Add device itself to the start of array
new_device_group.append(self._id + ":" + self.port)

# Call to get slaves
sync_status = await self.send_bluesound_command(
f"/SyncStatus"
)

slaves = []

# Extract information from slave objects
slave_objects = sync_status["SyncStatus"].get('slave', [])
if isinstance(slave_objects, list):
Expand All @@ -889,14 +890,12 @@ async def rebuild_bluesound_group(self):
slave_port = slave_obj['@port']
_LOGGER.debug("ID: %s", slave_id)
_LOGGER.debug("PORT: %s", slave_port)
slaves.append(slave_id + ":" + slave_port)
new_device_group.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)

new_device_group = slaves
new_device_group.append(slave_id + ":" + slave_port)
else:
_LOGGER.debug("Device is a slave: %s", new_device_group)

Expand Down

0 comments on commit 8f01db4

Please sign in to comment.