Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Nerwyn committed Oct 10, 2023
2 parents 6e59b02 + 8486fa8 commit 471d45a
Show file tree
Hide file tree
Showing 13 changed files with 412 additions and 356 deletions.
109 changes: 70 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ custom_keys:
toggle_light:
icon: mdi:lightbulb
service: light.toggle
service_data:
target:
entity_id: light.bedroom
```

Expand All @@ -193,7 +193,7 @@ custom_keys:
toggle_light:
icon: mdi:lightbulb
service: light.toggle
service_data:
target:
entity_id: light.bedroom
custom_sources:
browser:
Expand Down Expand Up @@ -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
Expand All @@ -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
```

Expand All @@ -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
```

Expand All @@ -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
```

Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
```

Expand Down
158 changes: 75 additions & 83 deletions dist/android-tv-card.js

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions info.md
Original file line number Diff line number Diff line change
@@ -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/)
Expand All @@ -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:**

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "android-tv-card",
"version": "2.1.3",
"version": "2.2.0",
"description": "Android TV Remote Card",
"main": "./dist/android-tv-card.js",
"scripts": {
Expand Down
Loading

0 comments on commit 471d45a

Please sign in to comment.