mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Add volume step to Russound media player (#122523)
* Add volume step to Russound media player * Add return types
This commit is contained in:
parent
9ecdee3b78
commit
cae992f5e6
@ -116,6 +116,7 @@ class RussoundZoneDevice(MediaPlayerEntity):
|
|||||||
_attr_has_entity_name = True
|
_attr_has_entity_name = True
|
||||||
_attr_supported_features = (
|
_attr_supported_features = (
|
||||||
MediaPlayerEntityFeature.VOLUME_SET
|
MediaPlayerEntityFeature.VOLUME_SET
|
||||||
|
| MediaPlayerEntityFeature.VOLUME_STEP
|
||||||
| MediaPlayerEntityFeature.TURN_ON
|
| MediaPlayerEntityFeature.TURN_ON
|
||||||
| MediaPlayerEntityFeature.TURN_OFF
|
| MediaPlayerEntityFeature.TURN_OFF
|
||||||
| MediaPlayerEntityFeature.SELECT_SOURCE
|
| MediaPlayerEntityFeature.SELECT_SOURCE
|
||||||
@ -211,21 +212,29 @@ class RussoundZoneDevice(MediaPlayerEntity):
|
|||||||
|
|
||||||
async def async_turn_off(self) -> None:
|
async def async_turn_off(self) -> None:
|
||||||
"""Turn off the zone."""
|
"""Turn off the zone."""
|
||||||
await self._zone.send_event("ZoneOff")
|
await self._zone.zone_off()
|
||||||
|
|
||||||
async def async_turn_on(self) -> None:
|
async def async_turn_on(self) -> None:
|
||||||
"""Turn on the zone."""
|
"""Turn on the zone."""
|
||||||
await self._zone.send_event("ZoneOn")
|
await self._zone.zone_on()
|
||||||
|
|
||||||
async def async_set_volume_level(self, volume: float) -> None:
|
async def async_set_volume_level(self, volume: float) -> None:
|
||||||
"""Set the volume level."""
|
"""Set the volume level."""
|
||||||
rvol = int(volume * 50.0)
|
rvol = int(volume * 50.0)
|
||||||
await self._zone.send_event("KeyPress", "Volume", rvol)
|
await self._zone.set_volume(rvol)
|
||||||
|
|
||||||
async def async_select_source(self, source: str) -> None:
|
async def async_select_source(self, source: str) -> None:
|
||||||
"""Select the source input for this zone."""
|
"""Select the source input for this zone."""
|
||||||
for source_id, src in self._sources.items():
|
for source_id, src in self._sources.items():
|
||||||
if src.name.lower() != source.lower():
|
if src.name.lower() != source.lower():
|
||||||
continue
|
continue
|
||||||
await self._zone.send_event("SelectSource", source_id)
|
await self._zone.select_source(source_id)
|
||||||
break
|
break
|
||||||
|
|
||||||
|
async def async_volume_up(self) -> None:
|
||||||
|
"""Step the volume up."""
|
||||||
|
await self._zone.volume_up()
|
||||||
|
|
||||||
|
async def async_volume_down(self) -> None:
|
||||||
|
"""Step the volume down."""
|
||||||
|
await self._zone.volume_down()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user