mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Set volume_step in frontier_silicon media_player (#105953)
This commit is contained in:
parent
90fef6b9c9
commit
3e50ca6cda
@ -152,6 +152,9 @@ 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()
|
||||
@ -239,18 +242,6 @@ 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
|
||||
|
Loading…
x
Reference in New Issue
Block a user