Skip to content

Commit

Permalink
feat: more translations, fix for volume and application_opened trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasvdh committed Mar 2, 2023
1 parent 464bf32 commit d9514b3
Show file tree
Hide file tree
Showing 24 changed files with 705 additions and 52 deletions.
12 changes: 12 additions & 0 deletions .homeychangelog.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,17 @@
"es": "Corregir el enlace incorrecto a la documentación de emparejamiento",
"da": "Fix forkert link til paringsdokumentation",
"pl": "Napraw nieprawidłowe połączenie do dokumentacji parowania"
},
"0.3.0": {
"en": "Fix for volume buttons, more translations and added initial \"application opened\" flow card trigger",
"nl": "Fix voor volume knoppen, meer vertalingen en eerste versie van flow kaart \"applicatie geopend\" toegevoegd",
"de": "Fix für Lautstärketasten, mehr Übersetzungen und Auslöser für die initiale \"Anwendung geöffnet\"-Flow-Karte hinzugefügt",
"fr": "Correction pour les boutons de volume, plus de traductions et ajout de la gâchette initiale de la carte de flux \"application ouverte\"",
"it": "Correzione per i pulsanti del volume, più traduzioni e aggiunta del trigger della carta di flusso \"applicazione aperta\" iniziale",
"sv": "Fix för volymknappar, fler översättningar och tillagd initial \"applikation öppnad\"-flödeskortsutlösare",
"no": "Fikset for volumknapper, flere oversettelser og lagt til utløser for den initielle \"applikasjonsåpnet\"-flytkortet",
"es": "Corrección para los botones de volumen, más traducciones y añadido el desencadenante de la tarjeta de flujo inicial \"aplicación abierta\"",
"da": "Fix til volumenknapper, flere oversættelser og tilføjet initial \"applikation åbnet\" flow-kort udløser",
"pl": "Poprawka dla przycisków głośności, więcej tłumaczeń i dodano początkowy wyzwalacz karty przepływu \"otwarta aplikacja\""
}
}
2 changes: 1 addition & 1 deletion .homeycompose/app.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "codes.lucasvdh.android-tv",
"version": "0.2.1",
"version": "0.3.0",
"compatibility": ">=5.0.0",
"sdk": 3,
"brandColor": "#3DDC84",
Expand Down
18 changes: 18 additions & 0 deletions .homeycompose/capabilities/measure_volume.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"type": "number",
"title": {
"en": "Volume",
"nl": "Volume"
},
"icon": "/assets/capabilities/measure_volume.svg",
"uiComponent": "sensor",
"getable": true,
"setable": false,
"units": {
"en": "%"
},
"decimals": 0,
"min": 0,
"max": 100,
"step": 1.0
}
14 changes: 0 additions & 14 deletions .homeycompose/capabilities/volume.json

This file was deleted.

38 changes: 38 additions & 0 deletions .homeycompose/flow/actions/send_key.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"id": "send_key",
"title": {
"en": "Send a key",
"nl": "Stuur een knop",
"de": "Sende eine Taste",
"fr": "Envoyer une touche",
"it": "Invia un tasto",
"sv": "Skicka en tangent",
"no": "Send en tast",
"es": "Enviar una tecla",
"da": "Send en tast",
"pl": "Wyślij klawisz"
},
"titleFormatted": {
"en": "Send key [[option]]",
"nl": "Stuur knop [[option]]",
"de": "Sende Taste [[option]]",
"fr": "Envoyer la touche [[option]]",
"it": "Invia tasto [[option]]",
"sv": "Skicka tangent [[option]]",
"no": "Send tast [[option]]",
"es": "Enviar tecla [[option]]",
"da": "Send tast [[option]]",
"pl": "Wyślij klawisz [[option]]"
},
"args": [
{
"name": "device",
"type": "device",
"filter": "driver_id=remote"
},
{
"name": "option",
"type": "autocomplete"
}
]
}
2 changes: 1 addition & 1 deletion .homeycompose/flow/triggers/application_opened.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
{
"name": "device",
"type": "device",
"filter": "driver_id=philips-jointspace"
"filter": "driver_id=remote"
}
]
}
65 changes: 58 additions & 7 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
{
"name": "device",
"type": "device",
"filter": "driver_id=philips-jointspace"
"filter": "driver_id=remote"
}
]
}
Expand Down Expand Up @@ -283,13 +283,60 @@
]
}
]
},
{
"id": "send_key",
"title": {
"en": "Send a key",
"nl": "Stuur een knop",
"de": "Sende eine Taste",
"fr": "Envoyer une touche",
"it": "Invia un tasto",
"sv": "Skicka en tangent",
"no": "Send en tast",
"es": "Enviar una tecla",
"da": "Send en tast",
"pl": "Wyślij klawisz"
},
"titleFormatted": {
"en": "Send key [[option]]",
"nl": "Stuur knop [[option]]",
"de": "Sende Taste [[option]]",
"fr": "Envoyer la touche [[option]]",
"it": "Invia tasto [[option]]",
"sv": "Skicka tangent [[option]]",
"no": "Send tast [[option]]",
"es": "Enviar tecla [[option]]",
"da": "Send tast [[option]]",
"pl": "Wyślij klawisz [[option]]"
},
"args": [
{
"name": "device",
"type": "device",
"filter": "driver_id=remote"
},
{
"name": "option",
"type": "autocomplete"
}
]
}
]
},
"drivers": [
{
"name": {
"en": "Remote"
"en": "Remote",
"nl": "Afstandsbediening",
"de": "Fernbedienung",
"fr": "Télécommande",
"it": "Telecomando",
"sv": "Fjärrkontroll",
"no": "Fjernkontroll",
"es": "Control remoto",
"da": "Fjernbetjening",
"pl": "Pilot zdalnego sterowania"
},
"pair": [
{
Expand Down Expand Up @@ -376,7 +423,7 @@
"discovery": "googlecast",
"capabilities": [
"onoff",
"volume",
"measure_volume",
"volume_up",
"volume_down",
"volume_mute",
Expand Down Expand Up @@ -654,18 +701,22 @@
"uiQuickAction": true,
"icon": "assets/capabilities/watch_tv.svg"
},
"volume": {
"measure_volume": {
"type": "number",
"title": {
"en": "Volume",
"nl": "Volume"
},
"uiComponent": "slider",
"icon": "/assets/capabilities/measure_volume.svg",
"uiComponent": "sensor",
"getable": true,
"setable": false,
"uiQuickAction": true,
"units": {
"en": "%"
},
"decimals": 0,
"min": 0,
"max": 15,
"max": 100,
"step": 1
}
},
Expand Down
21 changes: 21 additions & 0 deletions app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ class AndroidTV extends Homey.App {
this.homey.flow.getActionCard('select_source')
.registerRunListener(this.onFlowActionSelectSource)

this.homey.flow.getActionCard('send_key')
.registerRunListener(this.onFlowActionSendKey)
.registerArgumentAutocompleteListener('option', this.onFlowKeyAutocomplete.bind(this))

// this.homey.flow.getActionCard('send_key')
// .registerRunListener(this.onFlowActionSendKey)
// .registerArgumentAutocompleteListener('option', this.onFlowKeyAutocomplete.bind(this))
Expand All @@ -46,6 +50,23 @@ class AndroidTV extends Homey.App {
return device.openApplication(app)
}

async onFlowActionSendKey({device, option}: { device: RemoteDevice, option: { key: string } }) {
return device.sendKey(option.key)
}

async onFlowKeyAutocomplete(query: string, {device}: { device: RemoteDevice }): Promise<FlowCard.ArgumentAutocompleteResults> {
return (await device.getKeys())
.map(key => {
return {
'id': key.key,
'key': key.key,
'name': key.name
}
}).filter(result => {
return result.name.toLowerCase().indexOf(query.toLowerCase()) > -1
})
}

async onFlowApplicationAutocomplete(query: string, {device}: { device: RemoteDevice }): Promise<FlowCard.ArgumentAutocompleteResults> {
return [
{
Expand Down
1 change: 1 addition & 0 deletions assets/capabilities/measure_volume.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit d9514b3

Please sign in to comment.