Revert "Set volume_step in frontier_silicon media_player" (#106583)

Revert "Set volume_step in frontier_silicon media_player (#105953)"

This reverts commit 3e50ca6cda06a693002e0e7c69cbaa214145d053.
This commit is contained in:
Erik Montnemery 2023-12-28 19:50:57 +01:00 committed by Bram Kragten
parent 5125d8622d
commit df894acefa

View File

@ -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