Skip to content

Commit

Permalink
Ignore commands to sonos players if not available
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelveldt committed Jun 15, 2024
1 parent 86082e2 commit cf1d2e0
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion music_assistant/server/providers/sonos/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,14 @@ async def cmd_stop(self, player_id: str) -> None:
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:
Expand All @@ -280,6 +285,11 @@ async def cmd_play(self, player_id: str) -> None:
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:
Expand Down

0 comments on commit cf1d2e0

Please sign in to comment.