diff --git a/music_assistant/server/providers/sonos/__init__.py b/music_assistant/server/providers/sonos/__init__.py index f011aa243..9c109a8a7 100644 --- a/music_assistant/server/providers/sonos/__init__.py +++ b/music_assistant/server/providers/sonos/__init__.py @@ -5,7 +5,7 @@ import asyncio import logging import time -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, cast import shortuuid from aiohttp import web @@ -139,8 +139,9 @@ def __init__( @property def airplay_mode(self) -> bool: """Return if the player is in airplay mode.""" - return self.mass.config.get_raw_player_config_value( - self.airplay_player_id, CONF_AIRPLAY_MODE, False + return cast( + bool, + self.mass.config.get_raw_player_config_value(self.player_id, CONF_AIRPLAY_MODE, False), ) def get_linked_airplay_player(self, active_only: bool = True) -> Player | None: @@ -461,7 +462,7 @@ class SonosPlayerProvider(PlayerProvider): @property def supported_features(self) -> tuple[ProviderFeature, ...]: """Return the features supported by this Provider.""" - return (ProviderFeature.SYNC_PLAYERS, ProviderFeature.SYNC_GROUP) + return (ProviderFeature.SYNC_PLAYERS,) async def handle_async_init(self) -> None: """Handle async initialization of the provider.""" @@ -561,7 +562,9 @@ async def get_player_config_entries( "By default, Music Assistant uses the Sonos protocol for playback but with this " "feature enabled, it will use the Airplay protocol instead by redirecting " "the playback related commands to the linked Airplay player in Music Assistant, " - "allowing you to mix and match Sonos speakers with Airplay speakers.", + "allowing you to mix and match Sonos speakers with Airplay speakers. \n\n" + "TIP: When this feature is enabled, it make sense to set the underlying airplay " + "players to hide in the UI in the player settings to prevent duplicate players.", required=False, default_value=False, hidden=SonosCapability.AIRPLAY @@ -650,9 +653,11 @@ async def play_media( if len(sonos_player.client.player.group_members) > 1 else [] ) + if group_childs: + await self.cmd_unsync_many(group_childs) await self.mass.players.play_media(airplay.player_id, media) if group_childs: - self.mass.call_later(1, self.cmd_sync_many, player_id, group_childs) + self.mass.call_later(5, self.cmd_sync_many(player_id, group_childs)) return if media.queue_id: diff --git a/music_assistant/server/providers/sonos_s1/__init__.py b/music_assistant/server/providers/sonos_s1/__init__.py index 3f89ebd48..7b4b8e141 100644 --- a/music_assistant/server/providers/sonos_s1/__init__.py +++ b/music_assistant/server/providers/sonos_s1/__init__.py @@ -137,7 +137,7 @@ class SonosPlayerProvider(PlayerProvider): @property def supported_features(self) -> tuple[ProviderFeature, ...]: """Return the features supported by this Provider.""" - return (ProviderFeature.SYNC_PLAYERS, ProviderFeature.PLAYER_GROUP_CREATE) + return (ProviderFeature.SYNC_PLAYERS,) async def handle_async_init(self) -> None: """Handle async initialization of the provider."""