From df894acefa5bca0e2e221f8b7b3e74ea14005141 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Thu, 28 Dec 2023 19:50:57 +0100 Subject: [PATCH] Revert "Set volume_step in frontier_silicon media_player" (#106583) Revert "Set volume_step in frontier_silicon media_player (#105953)" This reverts commit 3e50ca6cda06a693002e0e7c69cbaa214145d053. --- .../components/frontier_silicon/media_player.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/frontier_silicon/media_player.py b/homeassistant/components/frontier_silicon/media_player.py index 565ee79b108..223abe26e55 100644 --- a/homeassistant/components/frontier_silicon/media_player.py +++ b/homeassistant/components/frontier_silicon/media_player.py @@ -152,9 +152,6 @@ class AFSAPIDevice(MediaPlayerEntity): if not self._max_volume: self._max_volume = int(await afsapi.get_volume_steps() or 1) - 1 - if self._max_volume: - self._attr_volume_step = 1 / self._max_volume - if self._attr_state != MediaPlayerState.OFF: info_name = await afsapi.get_play_name() info_text = await afsapi.get_play_text() @@ -242,6 +239,18 @@ class AFSAPIDevice(MediaPlayerEntity): await self.fs_device.set_mute(mute) # volume + async def async_volume_up(self) -> None: + """Send volume up command.""" + volume = await self.fs_device.get_volume() + volume = int(volume or 0) + 1 + await self.fs_device.set_volume(min(volume, self._max_volume)) + + async def async_volume_down(self) -> None: + """Send volume down command.""" + volume = await self.fs_device.get_volume() + volume = int(volume or 0) - 1 + await self.fs_device.set_volume(max(volume, 0)) + async def async_set_volume_level(self, volume: float) -> None: """Set volume command.""" if self._max_volume: # Can't do anything sensible if not set