Skip to content

Commit

Permalink
Remove device_trigger support
Browse files Browse the repository at this point in the history
Fix error formatting
  • Loading branch information
mj23000 committed Oct 1, 2024
1 parent f0a4302 commit f8ccb02
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 447 deletions.
3 changes: 1 addition & 2 deletions custom_components/bang_olufsen/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,7 @@ class BangOlufsenModelSupport(Enum):
)


# Device trigger events
BANG_OLUFSEN_EVENT: Final[str] = f"{DOMAIN}_event"
# Device events
BANG_OLUFSEN_WEBSOCKET_EVENT: Final[str] = f"{DOMAIN}_websocket_event"


Expand Down
20 changes: 0 additions & 20 deletions custom_components/bang_olufsen/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,13 @@
from mozart_api.mozart_client import MozartClient

from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_DEVICE_ID, CONF_TYPE
from homeassistant.core import HomeAssistant
from homeassistant.helpers import device_registry as dr
from homeassistant.helpers.dispatcher import async_dispatcher_send
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
from homeassistant.util.enum import try_parse_enum

from .const import (
BANG_OLUFSEN_EVENT,
BANG_OLUFSEN_WEBSOCKET_EVENT,
CONNECTION_STATUS,
DOMAIN,
Expand Down Expand Up @@ -168,15 +166,6 @@ def on_battery_notification(self, notification: BatteryState) -> None:
def on_beo_remote_button_notification(self, notification: BeoRemoteButton) -> None:
"""Send beo_remote_button dispatch."""
assert notification.type

# Trigger the device trigger
self.hass.bus.async_fire(
BANG_OLUFSEN_EVENT,
event_data={
CONF_TYPE: f"{notification.key}_{notification.type}",
CONF_DEVICE_ID: self._device.id,
},
)
# Send to event entity
async_dispatcher_send(
self.hass,
Expand All @@ -187,15 +176,6 @@ def on_beo_remote_button_notification(self, notification: BeoRemoteButton) -> No
def on_button_notification(self, notification: ButtonEvent) -> None:
"""Send button dispatch."""
assert notification.state

# Trigger the device trigger
self.hass.bus.async_fire(
BANG_OLUFSEN_EVENT,
event_data={
CONF_TYPE: f"{notification.button}_{notification.state}",
CONF_DEVICE_ID: self._device.id,
},
)
# Send to event entity
async_dispatcher_send(
self.hass,
Expand Down
209 changes: 0 additions & 209 deletions custom_components/bang_olufsen/device_trigger.py

This file was deleted.

4 changes: 2 additions & 2 deletions custom_components/bang_olufsen/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,7 @@ async def async_select_source(self, source: str) -> None:
translation_key="invalid_source",
translation_placeholders={
"invalid_source": source,
"valid_sources": ",".join(list(self._sources.values())),
"valid_sources": ", ".join(list(self._sources.values())),
},
)

Expand Down Expand Up @@ -1013,7 +1013,7 @@ async def async_play_media(
translation_key="invalid_media_type",
translation_placeholders={
"invalid_media_type": media_type,
"valid_media_types": ", ".join(VALID_MEDIA_TYPES),
"valid_media_types": ",".join(VALID_MEDIA_TYPES),
},
)

Expand Down
107 changes: 0 additions & 107 deletions custom_components/bang_olufsen/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,113 +34,6 @@
}
}
},
"device_automation": {
"trigger_type": {
"Bluetooth_shortPress": "Short press of Bluetooth",
"Bluetooth_longPress": "Long press of Bluetooth",
"Control/Blue_KeyPress": "Press of Beoremote One Control: Blue",
"Control/Blue_KeyRelease": "Release of Beoremote One Control: Blue",
"Control/Digit0_KeyPress": "Press of Beoremote One Control: 0",
"Control/Digit0_KeyRelease": "Release of Beoremote One Control: 0",
"Control/Digit1_KeyPress": "Press of Beoremote One Control: 1",
"Control/Digit1_KeyRelease": "Release of Beoremote One Control: 1",
"Control/Digit2_KeyPress": "Press of Beoremote One Control: 2",
"Control/Digit2_KeyRelease": "Release of Beoremote One Control: 2",
"Control/Digit3_KeyPress": "Press of Beoremote One Control: 3",
"Control/Digit3_KeyRelease": "Release of Beoremote One Control: 3",
"Control/Digit4_KeyPress": "Press of Beoremote One Control: 4",
"Control/Digit4_KeyRelease": "Release of Beoremote One Control: 4",
"Control/Digit5_KeyPress": "Press of Beoremote One Control: 5",
"Control/Digit5_KeyRelease": "Release of Beoremote One Control: 5",
"Control/Digit6_KeyPress": "Press of Beoremote One Control: 6",
"Control/Digit6_KeyRelease": "Release of Beoremote One Control: 6",
"Control/Digit7_KeyPress": "Press of Beoremote One Control: 7",
"Control/Digit7_KeyRelease": "Release of Beoremote One Control: 7",
"Control/Digit8_KeyPress": "Press of Beoremote One Control: 8",
"Control/Digit8_KeyRelease": "Release of Beoremote One Control: 8",
"Control/Digit9_KeyPress": "Press of Beoremote One Control: 9",
"Control/Digit9_KeyRelease": "Release of Beoremote One Control: 9",
"Control/Down_KeyPress": "Press of Beoremote One Control: Down",
"Control/Down_KeyRelease": "Release of Beoremote One Control: Down",
"Control/Green_KeyPress": "Press of Beoremote One Control: Green",
"Control/Green_KeyRelease": "Release of Beoremote One Control: Green",
"Control/Left_KeyPress": "Press of Beoremote One Control: Left",
"Control/Left_KeyRelease": "Release of Beoremote One Control: Left",
"Control/Play_KeyPress": "Press of Beoremote One Control: Play",
"Control/Play_KeyRelease": "Release of Beoremote One Control: Play",
"Control/Red_KeyPress": "Press of Beoremote One Control: Red",
"Control/Red_KeyRelease": "Release of Beoremote One Control: Red",
"Control/Rewind_KeyPress": "Press of Beoremote One Control Rewind",
"Control/Rewind_KeyRelease": "Release of Beoremote One Control Rewind",
"Control/Right_KeyPress": "Press of Beoremote One Control: Right",
"Control/Right_KeyRelease": "Release of Beoremote One Control: Right",
"Control/Select_KeyPress": "Press of Beoremote One Control: Select",
"Control/Select_KeyRelease": "Release of Beoremote One Control: Select",
"Control/Stop_KeyPress": "Press of Beoremote One Control: Stop",
"Control/Stop_KeyRelease": "Release of Beoremote One Control: Stop",
"Control/Up_KeyPress": "Press of Beoremote One Control: Up",
"Control/Up_KeyRelease": "Release of Beoremote One Control: Up",
"Control/Wind_KeyPress": "Press of Beoremote One Control Wind",
"Control/Wind_KeyRelease": "Release of Beoremote One Control Wind",
"Control/Yellow_KeyPress": "Press of Beoremote One Control: Yellow",
"Control/Yellow_KeyRelease": "Release of Beoremote One Control: Yellow",
"Light/Blue_KeyPress": "Press of Beoremote One Light: Blue",
"Light/Blue_KeyRelease": "Release of Beoremote One Light: Blue",
"Light/Digit0_KeyPress": "Press of Beoremote One Light: 0",
"Light/Digit0_KeyRelease": "Release of Beoremote One Light: 0",
"Light/Digit1_KeyPress": "Press of Beoremote One Light: 1",
"Light/Digit1_KeyRelease": "Release of Beoremote One Light: 1",
"Light/Digit2_KeyPress": "Press of Beoremote One Light: 2",
"Light/Digit2_KeyRelease": "Release of Beoremote One Light: 2",
"Light/Digit3_KeyPress": "Press of Beoremote One Light: 3",
"Light/Digit3_KeyRelease": "Release of Beoremote One Light: 3",
"Light/Digit4_KeyPress": "Press of Beoremote One Light: 4",
"Light/Digit4_KeyRelease": "Release of Beoremote One Light: 4",
"Light/Digit5_KeyPress": "Press of Beoremote One Light: 5",
"Light/Digit5_KeyRelease": "Release of Beoremote One Light: 5",
"Light/Digit6_KeyPress": "Press of Beoremote One Light: 6",
"Light/Digit6_KeyRelease": "Release of Beoremote One Light: 6",
"Light/Digit7_KeyPress": "Press of Beoremote One Light: 7",
"Light/Digit7_KeyRelease": "Release of Beoremote One Light: 7",
"Light/Digit8_KeyPress": "Press of Beoremote One Light: 8",
"Light/Digit8_KeyRelease": "Release of Beoremote One Light: 8",
"Light/Digit9_KeyPress": "Press of Beoremote One Light: 9",
"Light/Digit9_KeyRelease": "Release of Beoremote One Light: 9",
"Light/Down_KeyPress": "Press of Beoremote One Light: Down",
"Light/Down_KeyRelease": "Release of Beoremote One Light: Down",
"Light/Green_KeyPress": "Press of Beoremote One Light: Green",
"Light/Green_KeyRelease": "Release of Beoremote One Light: Green",
"Light/Left_KeyPress": "Press of Beoremote One Light: Left",
"Light/Left_KeyRelease": "Release of Beoremote One Light: Left",
"Light/Play_KeyPress": "Press of Beoremote One Light: Play",
"Light/Play_KeyRelease": "Release of Beoremote One Light: Play",
"Light/Red_KeyPress": "Press of Beoremote One Light: Red",
"Light/Red_KeyRelease": "Release of Beoremote One Light: Red",
"Light/Rewind_KeyPress": "Press of Beoremote One Light Rewind",
"Light/Rewind_KeyRelease": "Release of Beoremote One Light Rewind",
"Light/Right_KeyPress": "Press of Beoremote One Light: Right",
"Light/Right_KeyRelease": "Release of Beoremote One Light: Right",
"Light/Select_KeyPress": "Press of Beoremote One Light: Select",
"Light/Select_KeyRelease": "Release of Beoremote One Light: Select",
"Light/Stop_KeyPress": "Press of Beoremote One Light: Stop",
"Light/Stop_KeyRelease": "Release of Beoremote One Light: Stop",
"Light/Up_KeyPress": "Press of Beoremote One Light: Up",
"Light/Up_KeyRelease": "Release of Beoremote One Light: Up",
"Light/Wind_KeyPress": "Press of Beoremote One Light Wind",
"Light/Wind_KeyRelease": "Release of Beoremote One Light Wind",
"Light/Yellow_KeyPress": "Press of Beoremote One Light: Yellow",
"Light/Yellow_KeyRelease": "Release of Beoremote One Light: Yellow",
"Microphone_shortPress": "Short press of Microphone",
"Next_shortPress": "Short press of Next",
"PlayPause_shortPress": "Short press of Play/Pause",
"PlayPause_longPress": "Long press of Play/Pause",
"Preset1_shortPress": "Short press of Favourite 1",
"Preset2_shortPress": "Short press of Favourite 2",
"Preset3_shortPress": "Short press of Favourite 3",
"Preset4_shortPress": "Short press of Favourite 4",
"Previous_shortPress": "Short press of Previous"
}
},
"services": {
"beolink_join": {
"name": "Beolink join",
Expand Down
Loading

0 comments on commit f8ccb02

Please sign in to comment.