diff --git a/README.md b/README.md index 2f392dfa..077560ca 100644 --- a/README.md +++ b/README.md @@ -179,7 +179,7 @@ custom_keys: toggle_light: icon: mdi:lightbulb service: light.toggle - service_data: + target: entity_id: light.bedroom ``` @@ -193,7 +193,7 @@ custom_keys: toggle_light: icon: mdi:lightbulb service: light.toggle - service_data: + target: entity_id: light.bedroom custom_sources: browser: @@ -223,22 +223,25 @@ custom_keys: power: icon: mdi:power-cycle service: media_player.toggle - service_data: + target: entity_id: media_player.tv ``` Inside each button you may define `icon` and either `key`, `source` or `service`, as you've seen. -| Option | internal function | Description | -| ------------ | -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | -| icon | | The icon to show in the button. If empty the original key or source icon will be used if it exists, otherwise it will be empty. | -| key | `remote.send_command(command=key)` | The key to send to the TV via `remote.send_command`. | -| source | `remote.turn_on(activity=source)` | The source to switch to via `remote.turn_on`. | -| service | `_hass.callService(domain, service, service_data)` | A string representing service to call. Use the format `domain.service`, e.g. `"light.turn_on"`. | -| service_data | passed with `service` | The data to pass to the service. May be an object depending on the service you are using. | +| Option | internal function | Description | +| ------- | ----------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| icon | | The icon to show in the button. If empty the original key or source icon will be used if it exists, otherwise it will be empty. | +| key | `remote.send_command(command=key)` | The key to send to the TV via `remote.send_command`. | +| source | `remote.turn_on(activity=source)` | The source to switch to via `remote.turn_on`. | +| service | `hass.callService(domain, service, data)` | A string representing service to call. Use the format `domain.service`, e.g. `"light.turn_on"`. | +| data | Data to be passed with `service` | Additional data to pass to the service call. See the Home Assistant documentation or go to Developer Tools > Services to see available options for each service. | +| target | Target of the `service` | The entity IDs, device IDs, or area IDs to call the service on. | If an icon is not provided for a custom key or source that overwrites a predefined key or source, the original icon will be used instead. +`target`, `data`, and `service_data` (soft deprecated name for `data`) all get internally merged into one object since `hass.callService` only has a single data field for target and data. You can safely put all information into one object with any of these names. This was done so that you can easily design service calls using Home Assistant's service developer tool and copy the YAML to custom button configurations in this card. + ### Custom Touchpad Commands The touchpad can be customized using `custom_keys` so that it can be used with other devices @@ -249,28 +252,33 @@ Touchpad swipe and single click commands can be remapped by creating custom keys custom_keys: up: service: kodi.call_method - service_data: + target: entity_id: media_player.kodi + data: method: Input.Up down: service: kodi.call_method - service_data: + target: entity_id: media_player.kodi + data: method: Input.Down left: service: kodi.call_method - service_data: + target: entity_id: media_player.kodi + data: method: Input.Left right: service: kodi.call_method - service_data: + target: entity_id: media_player.kodi + data: method: Input.Right center: service: kodi.call_method - service_data: + target: entity_id: media_player.kodi + data: method: Input.Select ``` @@ -282,8 +290,9 @@ double_click_keycode: back custom_keys: back: service: kodi.call_method - service_data: + target: entity_id: media_player.kodi + data: method: Input.Back ``` @@ -294,8 +303,9 @@ long_click_keycode: menu custom_keys: menu: service: kodi.call_method - service_data: + target: entity_id: media_player.kodi + data: method: Input.ContextMenu ``` @@ -636,14 +646,16 @@ custom_keys: custom_sources: primevideo: service: media_player.select_source - service_data: + data: source: Prime Video + target: entity_id: media_player.appletv netflix: service: media_player.select_source - service_data: + data: source: Netflix - target: media_player.appletv + target: + entity_id: media_player.appletv card_mod: style: | toucharea { @@ -685,74 +697,87 @@ long_click_keycode: menu custom_keys: up: service: kodi.call_method - service_data: + target: entity_id: media_player.kodi + data: method: Input.Up down: service: kodi.call_method - service_data: + target: entity_id: media_player.kodi + data: method: Input.Down left: service: kodi.call_method - service_data: + target: entity_id: media_player.kodi + data: method: Input.Left right: service: kodi.call_method - service_data: + target: entity_id: media_player.kodi + data: method: Input.Right center: service: kodi.call_method - service_data: + target: entity_id: media_player.kodi + data: method: Input.Select back: service: kodi.call_method - service_data: + target: entity_id: media_player.kodi + data: method: Input.Back search: icon: mdi:kodi key: SEARCH volume_mute: service: kodi.call_method - service_data: + target: entity_id: media_player.kodi + data: method: Application.SetMute mute: toggle volume_up: service: kodi.call_method - service_data: + target: entity_id: media_player.kodi + data: method: Application.SetVolume volume: increment volume_down: service: kodi.call_method - service_data: + target: entity_id: media_player.kodi + data: method: Application.SetVolume volume: decrement menu: service: kodi.call_method - service_data: + target: entity_id: media_player.kodi + data: method: Input.ContextMenu home: service: kodi.call_method - service_data: + target: entity_id: media_player.kodi + data: method: Input.Home info: service: kodi.call_method - service_data: + target: entity_id: media_player.kodi + data: method: Input.Info play_pause: service: kodi.call_method - service_data: + target: entity_id: media_player.kodi + data: method: Player.PlayPause playerid: 1 card_mod: @@ -817,33 +842,39 @@ double_click_keycode: back custom_keys: down: service: denonavr.get_command - service_data: + target: entity_id: media_player.marantz_sr7013 + data: command: /goform/formiPhoneAppDirect.xml?MNCDN up: service: denonavr.get_command - service_data: + target: entity_id: media_player.marantz_sr7013 + data: command: /goform/formiPhoneAppDirect.xml?MNCUP left: service: denonavr.get_command - service_data: + target: entity_id: media_player.marantz_sr7013 + data: command: /goform/formiPhoneAppDirect.xml?MNCLT right: service: denonavr.get_command - service_data: + target: entity_id: media_player.marantz_sr7013 + data: command: /goform/formiPhoneAppDirect.xml?MNCRT center: service: denonavr.get_command - service_data: + target: entity_id: media_player.marantz_sr7013 + data: command: /goform/formiPhoneAppDirect.xml?MNENT back: service: denonavr.get_command - service_data: + target: entity_id: media_player.marantz_sr7013 + data: command: /goform/formiPhoneAppDirect.xml?MNRTN ``` diff --git a/info.md b/info.md index e32e27cb..05d7f01a 100644 --- a/info.md +++ b/info.md @@ -1,10 +1,10 @@ # Android TV Remote Card -Yet another tv-card for Home Assistant, specifically for the [Android TV Remote](https://www.home-assistant.io/integrations/androidtv_remote/) integration, that also allows for a greater level of customization and keyboard entry for multiple platforms. +A remote card for Home Assistant that also allows for a greater level of customization and keyboard entry for multiple platforms. Works with the [Android TV Remote](https://www.home-assistant.io/integrations/androidtv_remote/) integration by default but can be customized for use with any media platform. -- Fully configurable and remappable touchpad that can now be used for more any media platform. +- Fully configurable and remappable touchpad that can now be used for any media platform. - Holding directional and volume keys causes them to repeat until let go, with navigation behavior tweaked to behave more like the Google TV remote. -- Changes row configuration to nested arrays. Every level nested past the second array alternates between columns and rows, allowing for much more customization. +- Organize buttons into alternating nested rows and columns to create highly customizable layouts. - Many more default [keys](https://github.com/Nerwyn/android-tv-card/blob/main/src/models/defaultKeys.ts) and [sources](https://github.com/Nerwyn/android-tv-card/blob/main/src/models/defaultSources.ts) with [SVG icons](https://github.com/Nerwyn/android-tv-card/blob/main/src/models/enums/svg.ts) to match the sources. - _Not all working or tested at this time, let me know if you find the correct source/activity for the broken ones!_ - Keyboard text entry via the [Android Debug Bridge integration](https://www.home-assistant.io/integrations/androidtv/) @@ -13,6 +13,7 @@ Yet another tv-card for Home Assistant, specifically for the [Android TV Remote - `textbox`: bulk text entry. - `search`: Google Assistant search. - Also supports Kodi +- Example alternate media platform remote configs for Kodi, Apple TV, Sony Bravia TV, and Denon/Marantz in the README examples. **Sample overview:**