Skip to content

Commit 854a97b

Browse files
committed
prioritize custom action entity field for unified remote call target, add enter and delete default keys to all platforms that support them, add mousepad info to README
1 parent 9c2f61f commit 854a97b

File tree

9 files changed

+190
-30
lines changed

9 files changed

+190
-30
lines changed

README.md

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,16 @@ A super customizable universal remote card iterating on the work of several othe
2525
- Roku (with keyboard)
2626
- LG webOS (with keyboard)
2727
- Kodi (with keyboard)
28+
- Unified Remote for computers (with keyboard and mousepad)
2829
- Apple TV
2930
- Samsung TV
3031
- Jellyfin
31-
- Support for multiple buttons, touchpads, and sliders using default or user defined custom actions.
32+
- Support for multiple buttons, touchpads, mousepads, and sliders using default or user defined custom actions.
3233
- Complete [Home Assistant actions](https://www.home-assistant.io/dashboards/actions/) support.
3334
- Keyboard and search dialog actions for most platforms.
3435
- [Template](#a-note-on-templating) support for almost all fields using nunjucks.
3536
- Toggleable haptics.
36-
- Remappable touchpad with [multi-touch](#touchpad-actions) gesture support.
37+
- Remappable touchpad and mousepad with [multi-touch](#touchpad-actions) gesture support.
3738
- Remappable slider with vertical orientation support.
3839
- User configurable remote [layout](#layout).
3940
- Icons and labels for all elements.
@@ -64,10 +65,15 @@ This card supports several media platforms with default key and source lists. Fo
6465
| [Roku](https://www.home-assistant.io/integrations/roku/) | Default keys | Default sources and slider | Remote for keyboard, media player for search (provide one for keyboard ID and the others in their fields) |
6566
| [LG webOS](https://www.home-assistant.io/integrations/webostv/) | NA | Default keys, sources, and slider | Media Player |
6667
| [Kodi](https://www.home-assistant.io/integrations/kodi/) | NA | Default keys, sources, and slider | Media player |
68+
| [Unified Remote](https://github.com/DaviPtrs/hass-unified-remote) | NA (see below) | NA (see below) | NA (see below) |
6769
| [Apple TV](https://www.home-assistant.io/integrations/apple_tv) | Default keys | Default sources and slider | NA |
6870
| [Samsung TV](https://www.home-assistant.io/integrations/samsungtv/) | Default keys | Default sources (requires the [SamsungTV Smart Component custom integration](https://github.com/ollo69/ha-samsungtv-smart)) and slider | NA |
6971
| [Jellyfin](https://www.home-assistant.io/integrations/jellyfin/) | Default keys | Play/Pause and slider | NA |
7072

73+
### Unified Remote Setup
74+
75+
Unlike most platforms, Unified Remote relies entirely on [a custom integration](https://github.com/DaviPtrs/hass-unified-remote). This custom integration does not create any entities, but does provide us with the action `unified_remote.call`, which can be used to call any Unified Remote API. It requires that you install the integration and setup your computer hosts [as described here in its README](https://github.com/DaviPtrs/hass-unified-remote?tab=readme-ov-file#home-assistant). You can then use the host name or IP address in the remote and keyboard ID fields in the configuration UI (make sure it does not autofill with an actual entity, you may have to fix it with the code editor).
76+
7177
## Action Timings
7278

7379
Double tap and hold actions have user adjustable timings to change how they are triggered. These values can be set globally in the general tab or for each custom action.
@@ -171,11 +177,12 @@ The remote layout is defined using a series of nested arrays. The lowest level o
171177
- search
172178
```
173179
174-
The default keys and sources lists for your selected platform are displayed below the layout code editor. If you have configured any custom actions, they will be displayed above this. You can use this as reference as you create your remote, or drag and drop entries from these lists to the editor. The default keys list also includes the default touchpad and slider, along with some special elements for button pads and layouts. Not all special elements are available for all platforms.
180+
The default keys and sources lists for your selected platform are displayed below the layout code editor. If you have configured any custom actions, they will be displayed above this. You can use this as reference as you create your remote, or drag and drop entries from these lists to the editor. The default keys list also includes the default touchpad, mousepad, and slider, along with some special elements for button pads and layouts. Not all special elements are available for all platforms.
175181
176182
| Name | Type | Description |
177183
| ------------------ | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
178184
| touchpad | touchpad | A touchpad for navigation. |
185+
| mousepad | mousepad | A mousepad for mouse movement and scrolling. **NOTE**: Mousepad support is dependent on the platform support mouse control via its Home Assistant integration. |
179186
| slider | slider | A slider that controls the volume of the entity defined by `media_player_id`. **NOTE**: Volume slider support is dependent on the media player supporting the `media_player.volume_set` action. |
180187
| volume_buttons | button rows | Shorthand to generate a set of volume down, volume mute, and volume up buttons in a row or column. |
181188
| navigation_buttons | button rows | Shorthand to generate a set of up, down, left, right, and center buttons across three rows within a column. |
@@ -223,11 +230,11 @@ Sliders have some additional general options. They have a range `Min` and `Max`
223230

224231
Sliders will wait one second before updating their internal values from Home Assistant to prevent it from bouncing between the old and new values. This time can be changed by setting `Update after action delay`, which defaults to 1000ms
225232

226-
### Touchpad Tabs
233+
### Touchpad and Mousepad Tabs
227234

228235
<img src="https://raw.githubusercontent.com/Nerwyn/android-tv-card/main/assets/editor_actions_general_options_touchpad.png" alt="editor actions general options touchpad" width="600"/>
229236

230-
Touchpads have five tabs at the top of their actions page for each direction and it's center. Only the center tab has general options as these apply to the entire touchpad remote element. Each direction and center have their own options for appearance and interactions as described below.
237+
Touchpads and mousepads have five tabs at the top of their actions page for each direction and it's center. Only the center tab has general options as these apply to the entire touchpad remote element. Each direction and center have their own options for appearance and interactions (touchpad only) as described below.
231238

232239
## Appearance
233240

@@ -270,9 +277,9 @@ Sliders have an additional `Vertical` toggle which rotates it 90 degrees to make
270277
}
271278
```
272279

273-
### Multiple Icons and Labels for Touchpads
280+
### Multiple Icons and Labels for Touchpads and Mousepads
274281

275-
Touchpads can have a separate icon and label for the center and each direction. You can also style each of these icons and labels independently using their own `CSS Styles` fields. General touchpad styles such as those for `toucharea` like touchpad height should go in the center tab styles.
282+
Touchpads and mousepads can have a separate icon and label for the center and each direction. You can also style each of these icons and labels independently using their own `CSS Styles` fields. General touchpad and mousepad styles such as those for `toucharea` (mousepad also uses this element name) like height should go in the center tab styles.
276283

277284
### A Note on Templating
278285

@@ -282,7 +289,7 @@ You can include the current value of a remote element and it's units by using th
282289

283290
## Interactions
284291

285-
There are three traditional ways to trigger an action - tap, double tap, and hold. Buttons and touchpad center support all three, touchpad swipes only support tap and hold actions, and sliders only support tap actions. Defining a double tap action that is not `none` introduces a 200ms delay to single tap actions.
292+
There are three traditional ways to trigger an action - tap, double tap, and hold. Buttons, touch/mousepad center support all three, touchpad (not mousepad) swipes only support tap and hold actions, and sliders only support tap actions. Defining a double tap action that is not `none` introduces a 200ms delay to single tap actions.
286293

287294
<img src="https://raw.githubusercontent.com/Nerwyn/android-tv-card/main/assets/editor_actions_interactions.png" alt="editor actions interactions" width="600"/>
288295

@@ -341,6 +348,14 @@ The touchpad's center acts like a button, with support for the same actions. The
341348

342349
Touchpads also support multi-touch mode, which fires alternate actions when more than one finger is used with it. This mode is disabled by default but can be enabled by setting a touchpad's multi-touch actions to something other than `Nothing`. Multi-touch mode supports center tap, double tap, and hold actions, and direction swipe and hold actions.
343350

351+
### Mousepad Actions
352+
353+
TODO config UI and image
354+
355+
Similar to the touchpad, the mousepad's center acts like a button with support for tap, double tap, and hold actions, but it does not support momentary mode. The center also supports multi-touch mode. This mode is enabled by default.
356+
357+
Instead of seprate direction actions, mousepads support a mouse action. This action is called whenever movement is detected on the mousepad, and is meant to be used with mouse movement actions like Unified Remote's `Core.Input MoveBy`. The mouse X and Y movement can be added to actions using templates using `deltaX` and `deltaY`. The mouse action can also be used in multi-touch mode.
358+
344359
### Keyboard, Textbox, and Search
345360

346361
This card supports sending text to the following platforms:
@@ -349,9 +364,11 @@ This card supports sending text to the following platforms:
349364
- Sony BRAVIA
350365
- Fire TV
351366
- Roku
367+
- LG webOS
352368
- Kodi
369+
- Unified Remote (PC, Mac, Linux)
353370

354-
If the user defined general platform is listed above, then any action set to a keyboard action (that has autofill enabled) will inherit it. Otherwise it will default to `Android TV`. Keyboard support for more platforms can be added if there is a way to do so through their Home Assistant (or possibly community made) integrations.
371+
If the user defined general platform is listed above, then any action set to a keyboard action (that has autofill enabled) will inherit it. Otherwise it will default to `Android TV`. Keyboard support for more platforms can be added if there is a way to do so through their Home Assistant (or community made) integrations.
355372

356373
When you use any keyboard action, a dialog will open that can be typed into.
357374

@@ -381,6 +398,8 @@ Send text to your supported media platform in bulk using the action or default b
381398

382399
#### Search - Global Search
383400

401+
Not supported by the platforms LG webOS or Unified Remote.
402+
384403
Send a global search query to your media platform using the action or default button `search`. Like the bulk entry method, the dialog will not send any information until you tap the search button. This method cannot be used to enter text into currently visible text fields.
385404

386405
## Icons

dist/universal-remote-card.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/models/interfaces/IElementConfig.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export interface IElementConfig
2121
IButtonConfig,
2222
ISliderConfig,
2323
ITouchpadConfig,
24+
IMousepadConfig,
2425
IActions {}
2526

2627
interface IBaseElementConfig extends IDisplayConfig {
@@ -64,8 +65,4 @@ export interface ITouchpadConfig extends IBaseElementConfig, IActions {
6465
right?: IBasicActions & IMultiActions & IMomentaryActions & IDisplayConfig;
6566
}
6667

67-
export interface IMousepadConfig
68-
extends IBaseElementConfig,
69-
IBasicActions,
70-
IMultiActions,
71-
IMouseActions {}
68+
export interface IMousepadConfig extends ITouchpadConfig, IMouseActions {}

src/models/maps/android_tv/defaultKeys.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,12 @@ export const androidTVDefaultKeys: IElementConfig[] = [
143143
hold_action: { action: 'repeat' },
144144
},
145145
},
146+
{
147+
type: 'button',
148+
name: 'play_pause',
149+
tap_action: { action: 'key', key: 'MEDIA_PLAY_PAUSE' },
150+
icon: 'mdi:play-pause',
151+
},
146152
{
147153
type: 'button',
148154
name: 'play',
@@ -155,12 +161,6 @@ export const androidTVDefaultKeys: IElementConfig[] = [
155161
tap_action: { action: 'key', key: 'MEDIA_PAUSE' },
156162
icon: 'mdi:pause',
157163
},
158-
{
159-
type: 'button',
160-
name: 'play_pause',
161-
tap_action: { action: 'key', key: 'MEDIA_PLAY_PAUSE' },
162-
icon: 'mdi:play-pause',
163-
},
164164
{
165165
type: 'button',
166166
name: 'rewind',

src/models/maps/bravia/defaultKeys.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,25 @@ export const braviaTVDefaultKeys: IElementConfig[] = [
213213
tap_action: { action: 'search' },
214214
icon: 'mdi:google-assistant',
215215
},
216+
{
217+
type: 'button',
218+
name: 'delete',
219+
tap_action: { action: 'key', key: 'input keyevent 67' },
220+
hold_action: { action: 'repeat' },
221+
icon: 'mdi:backspace',
222+
},
223+
{
224+
type: 'button',
225+
name: 'enter',
226+
tap_action: {
227+
action: 'perform-action',
228+
perform_action: 'remote.send_command',
229+
data: {
230+
command: 'input keyevent 66',
231+
},
232+
},
233+
icon: 'mdi:magnify',
234+
},
216235
{
217236
type: 'button',
218237
name: 'channel_up',

src/models/maps/kodi/defaultKeys.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -189,44 +189,44 @@ export const kodiDefaultKeys: IElementConfig[] = [
189189
},
190190
{
191191
type: 'button',
192-
name: 'play',
192+
name: 'play_pause',
193193
tap_action: {
194194
action: 'perform-action',
195195
perform_action: 'kodi.call_method',
196196
data: {
197197
method: 'Player.PlayPause',
198198
playerid: 1,
199-
play: true,
200199
},
201200
},
202-
icon: 'mdi:play',
201+
icon: 'mdi:play-pause',
203202
},
204203
{
205204
type: 'button',
206-
name: 'pause',
205+
name: 'play',
207206
tap_action: {
208207
action: 'perform-action',
209208
perform_action: 'kodi.call_method',
210209
data: {
211210
method: 'Player.PlayPause',
212211
playerid: 1,
213-
play: false,
212+
play: true,
214213
},
215214
},
216-
icon: 'mdi:pause',
215+
icon: 'mdi:play',
217216
},
218217
{
219218
type: 'button',
220-
name: 'play_pause',
219+
name: 'pause',
221220
tap_action: {
222221
action: 'perform-action',
223222
perform_action: 'kodi.call_method',
224223
data: {
225224
method: 'Player.PlayPause',
226225
playerid: 1,
226+
play: false,
227227
},
228228
},
229-
icon: 'mdi:play-pause',
229+
icon: 'mdi:pause',
230230
},
231231
{
232232
type: 'button',

src/models/maps/unified_remote/defaultKeys.ts

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,10 @@ export const unifiedRemoteDefaultKeys: IElementConfig[] = [
196196
action: 'right',
197197
},
198198
},
199+
up: {},
200+
down: {},
201+
left: {},
202+
right: {},
199203
},
200204
{
201205
type: 'button',
@@ -466,4 +470,64 @@ export const unifiedRemoteDefaultKeys: IElementConfig[] = [
466470
tap_action: { action: 'textbox' },
467471
icon: 'mdi:text-box',
468472
},
473+
{
474+
type: 'button',
475+
name: 'delete',
476+
tap_action: {
477+
action: 'perform-action',
478+
perform_action: 'unified_remote.call',
479+
data: {
480+
remote_id: 'Core.Input',
481+
action: 'Press',
482+
extras: {
483+
Values: [
484+
{
485+
Value: 'back',
486+
},
487+
],
488+
},
489+
},
490+
},
491+
icon: 'mdi:backspace',
492+
},
493+
{
494+
type: 'button',
495+
name: 'forward_delete',
496+
tap_action: {
497+
action: 'perform-action',
498+
perform_action: 'unified_remote.call',
499+
data: {
500+
remote_id: 'Core.Input',
501+
action: 'Press',
502+
extras: {
503+
Values: [
504+
{
505+
Value: 'delete',
506+
},
507+
],
508+
},
509+
},
510+
},
511+
icon: 'mdi:backspace-reverse',
512+
},
513+
{
514+
type: 'button',
515+
name: 'enter',
516+
tap_action: {
517+
action: 'perform-action',
518+
perform_action: 'unified_remote.call',
519+
data: {
520+
remote_id: 'Core.Input',
521+
action: 'Press',
522+
extras: {
523+
Values: [
524+
{
525+
Value: 'enter',
526+
},
527+
],
528+
},
529+
},
530+
},
531+
icon: 'mdi:magnify',
532+
},
469533
];

src/models/maps/webos/defaultKeys.ts

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,42 @@ export const webosDefaultKeys: IElementConfig[] = [
219219
},
220220
icon: 'mdi:pause',
221221
},
222+
{
223+
type: 'button',
224+
name: 'stop',
225+
tap_action: {
226+
action: 'perform-action',
227+
perform_action: 'webostv.command',
228+
data: {
229+
command: 'media.controls/stop',
230+
},
231+
},
232+
icon: 'mdi:stop',
233+
},
234+
{
235+
type: 'button',
236+
name: 'rewind',
237+
tap_action: {
238+
action: 'perform-action',
239+
perform_action: 'webostv.command',
240+
data: {
241+
command: 'media.controls/rewind',
242+
},
243+
},
244+
icon: 'mdi:rewind',
245+
},
246+
{
247+
type: 'button',
248+
name: 'fast_forward',
249+
tap_action: {
250+
action: 'perform-action',
251+
perform_action: 'webostv.command',
252+
data: {
253+
command: 'media.controls/fastForward',
254+
},
255+
},
256+
icon: 'mdi:fast-forward',
257+
},
222258
{
223259
type: 'button',
224260
name: 'keyboard',
@@ -231,6 +267,30 @@ export const webosDefaultKeys: IElementConfig[] = [
231267
tap_action: { action: 'textbox' },
232268
icon: 'mdi:text-box',
233269
},
270+
{
271+
type: 'button',
272+
name: 'delete',
273+
tap_action: {
274+
action: 'perform-action',
275+
perform_action: 'webostv.command',
276+
data: {
277+
command: 'com.webos.service.ime/deleteCharacters',
278+
},
279+
},
280+
icon: 'mdi:backspace',
281+
},
282+
{
283+
type: 'button',
284+
name: 'enter',
285+
tap_action: {
286+
action: 'perform-action',
287+
perform_action: 'webostv.command',
288+
data: {
289+
command: 'com.webos.service.ime/sendEnterKey',
290+
},
291+
},
292+
icon: 'mdi:magnify',
293+
},
234294
{
235295
type: 'button',
236296
name: 'channel_up',

0 commit comments

Comments
 (0)