From cf1d2e09cf26ef390a2ee99874afa3171f1d7513 Mon Sep 17 00:00:00 2001 From: Marcel van der Veldt Date: Sat, 15 Jun 2024 07:34:07 +0200 Subject: [PATCH] Ignore commands to sonos players if not available --- music_assistant/server/providers/sonos/__init__.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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: -- 2.34.1