Skip to content

Commit

Permalink
feat: add channel up/down keys
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasvdh committed Oct 2, 2023
1 parent 44e29c3 commit 7c62ec0
Show file tree
Hide file tree
Showing 18 changed files with 102 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .homeycompose/capabilities/key_channel_down.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"type": "boolean",
"title": {
"en": "Channel down",
"nl": "Kanaal omlaag"
},
"getable": false,
"setable": true,
"uiComponent": "button",
"uiQuickAction": true,
"icon": "assets/capabilities/channel_down.svg"
}
12 changes: 12 additions & 0 deletions .homeycompose/capabilities/key_channel_up.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"type": "boolean",
"title": {
"en": "Channel up",
"nl": "Kanaal omhoog"
},
"getable": false,
"setable": true,
"uiComponent": "button",
"uiQuickAction": true,
"icon": "assets/capabilities/channel_up.svg"
}
26 changes: 26 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,8 @@
"key_previous",
"key_next",
"key_watch_tv",
"key_channel_up",
"key_channel_down",
"key_source"
],
"id": "remote",
Expand Down Expand Up @@ -627,6 +629,30 @@
"uiQuickAction": true,
"icon": "assets/capabilities/back.svg"
},
"key_channel_down": {
"type": "boolean",
"title": {
"en": "Channel down",
"nl": "Kanaal omlaag"
},
"getable": false,
"setable": true,
"uiComponent": "button",
"uiQuickAction": true,
"icon": "assets/capabilities/channel_down.svg"
},
"key_channel_up": {
"type": "boolean",
"title": {
"en": "Channel up",
"nl": "Kanaal omhoog"
},
"getable": false,
"setable": true,
"uiComponent": "button",
"uiQuickAction": true,
"icon": "assets/capabilities/channel_up.svg"
},
"key_confirm": {
"type": "boolean",
"title": {
Expand Down
1 change: 1 addition & 0 deletions assets/capabilities/channel_down.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/capabilities/channel_up.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions drivers/remote/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,14 @@ export default class AndroidTVRemoteClient {
this.client.sendKey(RemoteKeyCode.KEYCODE_MEDIA_NEXT, direction || RemoteDirection.SHORT)
}

public sendKeyChannelUp(direction: number | null = null): void {
this.client.sendKey(RemoteKeyCode.KEYCODE_CHANNEL_UP, direction || RemoteDirection.SHORT)
}

public sendKeyChannelDown(direction: number | null = null): void {
this.client.sendKey(RemoteKeyCode.KEYCODE_CHANNEL_DOWN, direction || RemoteDirection.SHORT)
}

public sendKeyMediaPrevious(direction: number | null = null): void {
this.client.sendKey(RemoteKeyCode.KEYCODE_MEDIA_PREVIOUS, direction || RemoteDirection.SHORT)
}
Expand Down
20 changes: 20 additions & 0 deletions drivers/remote/device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class RemoteDevice extends Remote {
'key_cursor_up',
'key_cursor_right',
'key_cursor_down',
'key_channel_up',
'key_channel_down',
// 'key_info',
// 'key_digit_1',
// 'key_digit_2',
Expand Down Expand Up @@ -201,6 +203,10 @@ class RemoteDevice extends Remote {
return this.client?.sendKeyMediaPrevious();
} else if (typeof capability.key_next !== 'undefined') {
return this.client?.sendKeyMediaNext();
} else if (typeof capability.key_channel_up !== 'undefined') {
return this.client?.sendKeyChannelUp();
} else if (typeof capability.key_channel_down !== 'undefined') {
return this.client?.sendKeyChannelDown();
}
// else if (typeof capability.key_adjust !== 'undefined') {
// return this.sendKey('Adjust')
Expand Down Expand Up @@ -277,6 +283,8 @@ class RemoteDevice extends Remote {
"key_cursor_right",
"key_cursor_down",
"key_cursor_left",
"key_channel_up",
"key_channel_down",
"key_back",
"key_home",
"key_confirm",
Expand Down Expand Up @@ -357,6 +365,10 @@ class RemoteDevice extends Remote {
this.client?.sendKeyMediaStop(direction);
} else if (key === 'key_next') {
this.client?.sendKeyMediaNext(direction);
} else if (key === 'key_channel_up') {
this.client?.sendKeyChannelUp(direction);
} else if (key === 'key_channel_down') {
this.client?.sendKeyChannelDown(direction);
} else if (key === 'key_cursor_left') {
this.client?.sendKeyDpadLeft(direction);
} else if (key === 'key_cursor_up') {
Expand Down Expand Up @@ -460,6 +472,14 @@ class RemoteDevice extends Remote {
key: 'key_cursor_down',
name: this.homey.__(`key.cursor_down`)
},
{
key: 'key_channel_up',
name: this.homey.__(`key.channel_up`)
},
{
key: 'key_channel_down',
name: this.homey.__(`key.channel_down`)
},
{
key: 'key_options',
name: this.homey.__(`key.options`)
Expand Down
2 changes: 2 additions & 0 deletions drivers/remote/driver.compose.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@
"key_previous",
"key_next",
"key_watch_tv",
"key_channel_up",
"key_channel_down",
"key_source"
]
}
2 changes: 2 additions & 0 deletions locales/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
"cursor_up": "Opad pil",
"cursor_right": "Højre pil",
"cursor_down": "Nedad pil",
"channel_up": "Kanal op",
"channel_down": "Kanal ned",
"options": "Indstillinger",
"back": "Tilbage",
"home": "Hjem"
Expand Down
2 changes: 2 additions & 0 deletions locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
"cursor_up": "D-Pad hoch",
"cursor_right": "D-Pad rechts",
"cursor_down": "D-Pad runter",
"channel_up": "Sender hoch",
"channel_down": "Sender runter",
"options": "Optionen",
"back": "Zurück",
"home": "Home"
Expand Down
2 changes: 2 additions & 0 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
"cursor_up": "D-pad up",
"cursor_right": "D-pad right",
"cursor_down": "D-pad down",
"channel_up": "Channel up",
"channel_down": "Channel down",
"options": "Options",
"back": "Back",
"home": "Home"
Expand Down
2 changes: 2 additions & 0 deletions locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
"cursor_up": "Arriba",
"cursor_right": "Derecha",
"cursor_down": "Abajo",
"channel_up": "Subir canal",
"channel_down": "Bajar canal",
"options": "Opciones",
"back": "Atrás",
"home": "Inicio"
Expand Down
2 changes: 2 additions & 0 deletions locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
"cursor_up": "Flèche haut",
"cursor_right": "Flèche droite",
"cursor_down": "Flèche bas",
"channel_up": "Monter la chaîne",
"channel_down": "Descendre la chaîne",
"options": "Options",
"back": "Retour",
"home": "Accueil"
Expand Down
2 changes: 2 additions & 0 deletions locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
"cursor_up": "Freccia su",
"cursor_right": "Freccia destra",
"cursor_down": "Freccia giù",
"channel_up": "Canale su",
"channel_down": "Canale giù",
"options": "Opzioni",
"back": "Indietro",
"home": "Home"
Expand Down
2 changes: 2 additions & 0 deletions locales/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
"cursor_up": "D-pad omhoog",
"cursor_right": "D-pad rechts",
"cursor_down": "D-pad omlaag",
"channel_up": "Kanaal omhoog",
"channel_down": "Kanaal omlaag",
"options": "Opties",
"back": "Terug",
"home": "Start"
Expand Down
2 changes: 2 additions & 0 deletions locales/no.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
"cursor_up": "Pil opp",
"cursor_right": "Pil høyre",
"cursor_down": "Pil ned",
"channel_up": "Kanal opp",
"channel_down": "Kanal ned",
"options": "Alternativer",
"back": "Tilbake",
"home": "Hjem"
Expand Down
2 changes: 2 additions & 0 deletions locales/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
"cursor_up": "Kursor w górę",
"cursor_right": "Kursor w prawo",
"cursor_down": "Kursor w dół",
"channel_up": "Zwiększ kanał",
"channel_down": "Zmniejsz kanał",
"options": "Opcje",
"back": "Powrót",
"home": "Strona główna"
Expand Down
2 changes: 2 additions & 0 deletions locales/sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
"cursor_up": "D-pad upp",
"cursor_right": "D-pad höger",
"cursor_down": "D-pad ner",
"channel_up": "Byt upp kanal",
"channel_down": "Byt ner kanal",
"options": "Alternativ",
"back": "Tillbaka",
"home": "Hem"
Expand Down

0 comments on commit 7c62ec0

Please sign in to comment.