From 8f01db4c6a87675fc3eea030744e5a5b2d482bc2 Mon Sep 17 00:00:00 2001 From: aunefyren Date: Tue, 30 Jan 2024 16:08:14 +0100 Subject: [PATCH] Update media_player.py --- custom_components/bluesound_alt/media_player.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/custom_components/bluesound_alt/media_player.py b/custom_components/bluesound_alt/media_player.py index 7659846..db4ecea 100644 --- a/custom_components/bluesound_alt/media_player.py +++ b/custom_components/bluesound_alt/media_player.py @@ -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): @@ -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)