Use volume up/down from enigma2 API (#106674)
enigma2: use volume up/down from enigma2 API
This commit is contained in:
parent
197525c697
commit
f22d6a4279
1 changed files with 3 additions and 7 deletions
|
@ -2,7 +2,7 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from openwebif.api import OpenWebIfDevice
|
from openwebif.api import OpenWebIfDevice
|
||||||
from openwebif.enums import RemoteControlCodes
|
from openwebif.enums import RemoteControlCodes, SetVolumeOption
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import (
|
from homeassistant.components.media_player import (
|
||||||
|
@ -142,15 +142,11 @@ class Enigma2Device(MediaPlayerEntity):
|
||||||
|
|
||||||
async def async_volume_up(self) -> None:
|
async def async_volume_up(self) -> None:
|
||||||
"""Volume up the media player."""
|
"""Volume up the media player."""
|
||||||
if self._attr_volume_level is None:
|
await self._device.set_volume(SetVolumeOption.UP)
|
||||||
return
|
|
||||||
await self._device.set_volume(int(self._attr_volume_level * 100) + 5)
|
|
||||||
|
|
||||||
async def async_volume_down(self) -> None:
|
async def async_volume_down(self) -> None:
|
||||||
"""Volume down media player."""
|
"""Volume down media player."""
|
||||||
if self._attr_volume_level is None:
|
await self._device.set_volume(SetVolumeOption.DOWN)
|
||||||
return
|
|
||||||
await self._device.set_volume(int(self._attr_volume_level * 100) - 5)
|
|
||||||
|
|
||||||
async def async_media_stop(self) -> None:
|
async def async_media_stop(self) -> None:
|
||||||
"""Send stop command."""
|
"""Send stop command."""
|
||||||
|
|
Loading…
Add table
Reference in a new issue