Skip to content

Commit

Permalink
Chore: don't try to save (fake) power state
Browse files Browse the repository at this point in the history
Players should provide their own power state or we add a user configurable powercommand handler
  • Loading branch information
marcelveldt committed Jan 23, 2025
1 parent aad9970 commit da246f2
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions music_assistant/controllers/players.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,9 +358,6 @@ async def cmd_power(self, player_id: str, powered: bool, skip_update: bool = Fal
# allow the stop command to process and prevent race conditions
await asyncio.sleep(0.2)

# store last power state in cache
await self.mass.cache.set(player_id, powered, base_key="player_power")

# always optimistically set the power state to update the UI
# as fast as possible and prevent race conditions
player.powered = powered
Expand Down Expand Up @@ -847,12 +844,6 @@ async def register(self, player: Player) -> None:
if not player.enabled:
return

# restore powered state from cache
if player.state == PlayerState.PLAYING:
player.powered = True
elif (cache := await self.mass.cache.get(player_id, base_key="player_power")) is not None:
player.powered = cache

self.logger.info(
"Player registered: %s/%s",
player_id,
Expand Down

0 comments on commit da246f2

Please sign in to comment.