Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Squeezebox grouping #70962

Merged
merged 3 commits into from
Apr 29, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Deprecate services/properties over time
  • Loading branch information
rajlaud committed Apr 28, 2022
commit 9519ea67c85fd7efb3cb951e50c9ccfb0686e86a
29 changes: 29 additions & 0 deletions homeassistant/components/squeezebox/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,11 @@

SERVICE_CALL_METHOD = "call_method"
SERVICE_CALL_QUERY = "call_query"
SERVICE_SYNC = "sync"
SERVICE_UNSYNC = "unsync"

ATTR_QUERY_RESULT = "query_result"
ATTR_SYNC_GROUP = "sync_group"

SIGNAL_PLAYER_REDISCOVERED = "squeezebox_player_rediscovered"

Expand All @@ -78,6 +81,7 @@

ATTR_TO_PROPERTY = [
ATTR_QUERY_RESULT,
ATTR_SYNC_GROUP,
]

SQUEEZEBOX_MODE = {
Expand Down Expand Up @@ -192,6 +196,12 @@ async def _discovered_player(player):
},
"async_call_query",
)
platform.async_register_entity_service(
SERVICE_SYNC,
{vol.Required(ATTR_OTHER_PLAYER): cv.string},
"async_sync",
)
platform.async_register_entity_service(SERVICE_UNSYNC, None, "async_unsync")

# Start server discovery task if not already running
if hass.is_running:
Expand Down Expand Up @@ -381,6 +391,11 @@ def group_members(self):
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."""
Expand Down Expand Up @@ -545,10 +560,24 @@ async def async_join_players(self, group_members):
"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(
Expand Down