mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 17:27:10 +00:00
parent
a8becb1248
commit
92ed20ffbf
@ -47,7 +47,7 @@ class RoonEventEntity(EventEntity):
|
|||||||
"""Representation of a Roon Event entity."""
|
"""Representation of a Roon Event entity."""
|
||||||
|
|
||||||
_attr_device_class = EventDeviceClass.BUTTON
|
_attr_device_class = EventDeviceClass.BUTTON
|
||||||
_attr_event_types = ["volume_up", "volume_down"]
|
_attr_event_types = ["volume_up", "volume_down", "mute_toggle"]
|
||||||
_attr_translation_key = "volume"
|
_attr_translation_key = "volume"
|
||||||
|
|
||||||
def __init__(self, server, player_data):
|
def __init__(self, server, player_data):
|
||||||
@ -77,15 +77,17 @@ class RoonEventEntity(EventEntity):
|
|||||||
) -> None:
|
) -> None:
|
||||||
"""Callbacks from the roon api with volume request."""
|
"""Callbacks from the roon api with volume request."""
|
||||||
|
|
||||||
if event != "set_volume":
|
if event == "set_mute":
|
||||||
|
event = "mute_toggle"
|
||||||
|
elif event == "set_volume":
|
||||||
|
if value > 0:
|
||||||
|
event = "volume_up"
|
||||||
|
else:
|
||||||
|
event = "volume_down"
|
||||||
|
else:
|
||||||
_LOGGER.debug("Received unsupported roon volume event %s", event)
|
_LOGGER.debug("Received unsupported roon volume event %s", event)
|
||||||
return
|
return
|
||||||
|
|
||||||
if value > 0:
|
|
||||||
event = "volume_up"
|
|
||||||
else:
|
|
||||||
event = "volume_down"
|
|
||||||
|
|
||||||
self._trigger_event(event)
|
self._trigger_event(event)
|
||||||
self.schedule_update_ha_state()
|
self.schedule_update_ha_state()
|
||||||
|
|
||||||
|
@ -29,7 +29,8 @@
|
|||||||
"event_type": {
|
"event_type": {
|
||||||
"state": {
|
"state": {
|
||||||
"volume_up": "Volume up",
|
"volume_up": "Volume up",
|
||||||
"volume_down": "Volume down"
|
"volume_down": "Volume down",
|
||||||
|
"mute_toggle": "Mute toggle"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user