Fix bluesound volume jumping back after volume_set.
authorMarvin Schenkel <marvinschenkel@gmail.com>
Mon, 23 Feb 2026 07:18:53 +0000 (08:18 +0100)
committerMarvin Schenkel <marvinschenkel@gmail.com>
Mon, 23 Feb 2026 07:18:53 +0000 (08:18 +0100)
music_assistant/providers/bluesound/player.py

index 2086f343f384f24673f1587ead551f6f725ba769..4ae2cc39c6a7f7fc21547b5c3c70356545c61edd 100644 (file)
@@ -25,7 +25,6 @@ from music_assistant.providers.bluesound.const import (
     IDLE_POLL_INTERVAL,
     PLAYBACK_POLL_INTERVAL,
     PLAYBACK_STATE_MAP,
-    PLAYBACK_STATE_POLL_MAP,
     PLAYER_FEATURES_BASE,
     PLAYER_SOURCE_MAP,
     POLL_STATE_DYNAMIC,
@@ -147,8 +146,10 @@ class BluesoundPlayer(Player):
 
     async def volume_set(self, volume_level: int) -> None:
         """Send VOLUME_SET command to BluOS player."""
-        await self.client.volume(level=volume_level, timeout=1)
-        self.logger.debug("Set BluOS speaker volume to %s", volume_level)
+        volume_response = await self.client.volume(level=volume_level, timeout=1)
+        self.logger.debug(
+            "Set BluOS speaker volume to %s, response: %s", volume_level, volume_response
+        )
         self._attr_volume_level = volume_level
         self._set_polling_dynamic()
         self.update_state()
@@ -341,9 +342,7 @@ class BluesoundPlayer(Player):
             self.update_state()
             return
 
-        if (
-            self.poll_state == POLL_STATE_DYNAMIC and self.dynamic_poll_count <= 0
-        ) or self._attr_playback_state == PLAYBACK_STATE_POLL_MAP[self.status.state]:
+        if self.poll_state == POLL_STATE_DYNAMIC and self.dynamic_poll_count <= 0:
             self.logger.debug(f"Changing bluos poll state from {self.poll_state} to static")
             self.poll_state = POLL_STATE_STATIC
 
@@ -374,6 +373,10 @@ class BluesoundPlayer(Player):
             self._attr_volume_level = self.sync_status.volume
         self._attr_volume_muted = self.status.mute
 
+        self.logger.debug(
+            f"Volume from sync_status: {self.sync_status.volume}, from status: {self.status.volume}"
+        )
+
         if not self.sync_status.leader:
             # Player not grouped or player is group leader
             if self.sync_status.followers: