From: Marcel van der Veldt Date: Sat, 15 Jun 2024 05:34:07 +0000 (+0200) Subject: Ignore commands to sonos players if not available X-Git-Url: https://git.kitaultman.com/?a=commitdiff_plain;h=cf1d2e09cf26ef390a2ee99874afa3171f1d7513;p=music-assistant-server.git Ignore commands to sonos players if not available --- diff --git a/music_assistant/server/providers/sonos/__init__.py b/music_assistant/server/providers/sonos/__init__.py index 41628b56..d45c3cbc 100644 --- a/music_assistant/server/providers/sonos/__init__.py +++ b/music_assistant/server/providers/sonos/__init__.py @@ -266,9 +266,14 @@ class SonosPlayerProvider(PlayerProvider): if sonos_player.sync_coordinator: self.logger.debug( "Ignore STOP command for %s: Player is synced to another player.", - player_id, + sonos_player.zone_name, ) return + if "Stop" not in sonos_player.soco.available_actions: + self.logger.debug( + "Ignore STOP command for %s: Player reports this action is not available now.", + sonos_player.zone_name, + ) await asyncio.to_thread(sonos_player.soco.stop) async def cmd_play(self, player_id: str) -> None: @@ -280,6 +285,11 @@ class SonosPlayerProvider(PlayerProvider): player_id, ) return + if "Play" not in sonos_player.soco.available_actions: + self.logger.debug( + "Ignore STOP command for %s: Player reports this action is not available now.", + sonos_player.zone_name, + ) await asyncio.to_thread(sonos_player.soco.play) async def cmd_pause(self, player_id: str) -> None: