diff --git a/homeassistant/components/squeezebox/media_player.py b/homeassistant/components/squeezebox/media_player.py index a3cc2120751..bd1f29f4e69 100644 --- a/homeassistant/components/squeezebox/media_player.py +++ b/homeassistant/components/squeezebox/media_player.py @@ -238,6 +238,7 @@ class SqueezeBoxEntity(MediaPlayerEntity): | MediaPlayerEntityFeature.SHUFFLE_SET | MediaPlayerEntityFeature.CLEAR_PLAYLIST | MediaPlayerEntityFeature.STOP + | MediaPlayerEntityFeature.GROUPING ) def __init__(self, player): @@ -393,7 +394,7 @@ class SqueezeBoxEntity(MediaPlayerEntity): return self._player.shuffle == "song" @property - def sync_group(self): + def group_members(self): """List players we are synced with.""" player_ids = { p.unique_id: p.entity_id for p in self.hass.data[DOMAIN][KNOWN_PLAYERS] @@ -404,6 +405,11 @@ class SqueezeBoxEntity(MediaPlayerEntity): sync_group.append(player_ids[player]) return sync_group + @property + def sync_group(self): + """List players we are synced with. Deprecated.""" + return self.group_members + @property def query_result(self): """Return the result from the call_query service.""" @@ -560,9 +566,9 @@ class SqueezeBoxEntity(MediaPlayerEntity): self._query_result = await self._player.async_query(*all_params) _LOGGER.debug("call_query got result %s", self._query_result) - async def async_sync(self, other_player): + async def async_join_players(self, group_members): """ - Add another Squeezebox player to this player's sync group. + Add other Squeezebox players to this player's sync group. If the other player is a member of a sync group, it will leave the current sync group without asking. @@ -570,15 +576,33 @@ class SqueezeBoxEntity(MediaPlayerEntity): player_ids = { p.entity_id: p.unique_id for p in self.hass.data[DOMAIN][KNOWN_PLAYERS] } - if other_player_id := player_ids.get(other_player): - await self._player.async_sync(other_player_id) - else: - _LOGGER.info("Could not find player_id for %s. Not syncing", other_player) - async def async_unsync(self): + for other_player in group_members: + if other_player_id := player_ids.get(other_player): + await self._player.async_sync(other_player_id) + else: + _LOGGER.info( + "Could not find player_id for %s. Not syncing", other_player + ) + + async def async_sync(self, other_player): + """Sync this Squeezebox player to another. Deprecated.""" + _LOGGER.warning( + "Service squeezebox.sync is deprecated; use media_player.join_players instead" + ) + await self.async_join_players([other_player]) + + async def async_unjoin_player(self): """Unsync this Squeezebox player.""" await self._player.async_unsync() + async def async_unsync(self): + """Unsync this Squeezebox player. Deprecated.""" + _LOGGER.warning( + "Service squeezebox.unsync is deprecated; use media_player.unjoin_player instead" + ) + await self.async_unjoin_player() + async def async_browse_media(self, media_content_type=None, media_content_id=None): """Implement the websocket media browsing helper.""" _LOGGER.debug(