From: Marcel van der Veldt Date: Thu, 26 Feb 2026 09:27:34 +0000 (+0100) Subject: Fix power control on play X-Git-Url: https://git.kitaultman.com/?a=commitdiff_plain;h=01495350af244fe19295c3ade7b6947b09c41c3f;p=music-assistant-server.git Fix power control on play --- diff --git a/music_assistant/controllers/players/controller.py b/music_assistant/controllers/players/controller.py index 5c78cb3e..25717816 100644 --- a/music_assistant/controllers/players/controller.py +++ b/music_assistant/controllers/players/controller.py @@ -2572,18 +2572,19 @@ class PlayerController(ProtocolLinkingMixin, CoreController): return # nothing to do # ungroup player at power off - player_was_synced = bool( - player.state.synced_to or player.group_members or player.state.active_group - ) - if player_was_synced and player.type == PlayerType.PLAYER and not powered: + player_was_sync_child = bool(player.state.synced_to or player.state.active_group) + if ( + (player_was_sync_child or player.group_members) + and player.type == PlayerType.PLAYER + and not powered + ): # ungroup player if it is synced (or is a sync leader itself) - # NOTE: ungroup will be ignored if the player is not grouped or synced await self.cmd_ungroup(player_id) # always stop player at power off if ( not powered - and not player_was_synced + and not player_was_sync_child and player_state.playback_state in (PlaybackState.PLAYING, PlaybackState.PAUSED) ): await self._handle_cmd_stop(player_id) @@ -2736,6 +2737,10 @@ class PlayerController(ProtocolLinkingMixin, CoreController): if media.source_id: player.set_active_mass_source(media.source_id) + # power on the player if needed + if not player.state.powered and player.state.power_control != PLAYER_CONTROL_NONE: + await self._handle_cmd_power(player.player_id, True) + # Determine output protocol to use: # If player already has an active protocol set, prefer that. # Otherwise, select best protocol based on current state.