Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple big improvements #31

Merged
merged 13 commits into from
May 12, 2022
Merged
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/.idea
/.vscode
/node_modules
/node_modules

# Added by Homey CLI
/.homeybuild/
7 changes: 7 additions & 0 deletions .homeyignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.git
/tools
*.md
/LICENSE
package-lock.json
package.json
/tests
17 changes: 13 additions & 4 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class PhilipsTV extends Homey.App {
.register()
.registerRunListener(this.onFlowActionSendKey)
.getArgument('option')
.registerAutocompleteListener(this.onFlowKeyAutocomplete);
.registerAutocompleteListener(this.onFlowKeyAutocomplete.bind(this));

this.log('Initialized flow');
}
Expand Down Expand Up @@ -95,9 +95,9 @@ class PhilipsTV extends Homey.App {

let results = client.getPossibleKeys().map(key => {
return {
"id": key.inputname,
"key": key.inputname,
"name": key.friendlyName
"id": key.inputName,
"key": key.inputName,
"name": this.getI18nString(key.friendlyName)
}
}).filter(result => {
return result.name.toLowerCase().indexOf(query.toLowerCase()) > -1;
Expand All @@ -106,6 +106,15 @@ class PhilipsTV extends Homey.App {
return Promise.resolve(results);
}

getI18nString(i18n) {
const lang = Homey.ManagerI18n.getLanguage();
if (i18n[lang])
return i18n[lang];
else if (i18n['en'])
return i18n['en'];
else
return `Untranslated string: ${i18n}`;
}
}

module.exports = PhilipsTV;
331 changes: 331 additions & 0 deletions assets/json/allPossibleInputs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,331 @@
[
{
"inputName": "Standby",
"friendlyName": {
"en": "On/Off",
"nl": "Aan/Uit"
}
},
{
"inputName": "Back",
"friendlyName": {
"en": "Back",
"nl": "Terug"
}
},
{
"inputName": "Find",
"friendlyName": {
"en": "Find",
"nl": "Zoek"
}
},
{
"inputName": "RedColour",
"friendlyName": {
"en": "Red",
"nl": "Rood"
}
},
{
"inputName": "GreenColour",
"friendlyName": {
"en": "Green",
"nl": "Groen"
}
},
{
"inputName": "YellowColour",
"friendlyName": {
"en": "Yellow",
"nl": "Geel"
}
},
{
"inputName": "BlueColour",
"friendlyName": {
"en": "Blue",
"nl": "Blauw"
}
},
{
"inputName": "Home",
"friendlyName": {
"en": "Home",
"nl": "Home"
}
},
{
"inputName": "VolumeUp",
"friendlyName": {
"en": "Volume Up",
"nl": "Volume Up"
}
},
{
"inputName": "VolumeDown",
"friendlyName": {
"en": "Volume Down",
"nl": "Volume Down"
}
},
{
"inputName": "Mute",
"friendlyName": {
"en": "Mure on/off",
"nl": "Mute on/off"
}
},
{
"inputName": "Options",
"friendlyName": {
"en": "Options",
"nl": "Options"
}
},
{
"inputName": "Dot",
"friendlyName": {
"en": "Dot",
"nl": "Punt"
}
},
{
"inputName": "Digit0",
"friendlyName": {
"en": "Digit 0",
"nl": "Cijfer 0"
}
},
{
"inputName": "Digit1",
"friendlyName": {
"en": "Digit 1",
"nl": "Cijfer 1"
}
},
{
"inputName": "Digit2",
"friendlyName": {
"en": "Digit 2",
"nl": "Cijfer 2"
}
},
{
"inputName": "Digit3",
"friendlyName": {
"en": "Digit 3",
"nl": "Cijfer 3"
}
},
{
"inputName": "Digit4",
"friendlyName": {
"en": "Digit 4",
"nl": "Cijfer 4"
}
},
{
"inputName": "Digit5",
"friendlyName": {
"en": "Digit 5",
"nl": "Cijfer 5"
}
},
{
"inputName": "Digit6",
"friendlyName": {
"en": "Digit 6",
"nl": "Cijfer 6"
}
},
{
"inputName": "Digit7",
"friendlyName": {
"en": "Digit 7",
"nl": "Cijfer 7"
}
},
{
"inputName": "Digit8",
"friendlyName": {
"en": "Digit 8",
"nl": "Cijfer 8"
}
},
{
"inputName": "Digit9",
"friendlyName": {
"en": "Digit 9",
"nl": "Cijfer 9"
}
},
{
"inputName": "Info",
"friendlyName": {
"en": "Info",
"nl": "Info"
}
},
{
"inputName": "CursorUp",
"friendlyName": {
"en": "Cursor Up",
"nl": "Cursor Omhoog"
}
},
{
"inputName": "CursorDown",
"friendlyName": {
"en": "Cursor Down",
"nl": "Cursor Omlaag"
}
},
{
"inputName": "CursorLeft",
"friendlyName": {
"en": "Cursor Left",
"nl": "Cursor Links"
}
},
{
"inputName": "CursorRight",
"friendlyName": {
"en": "Cursor Right",
"nl": "Cursor Rechts"
}
},
{
"inputName": "Confirm",
"friendlyName": {
"en": "Ok",
"nl": "Ok"
}
},
{
"inputName": "Next",
"friendlyName": {
"en": "Next",
"nl": "Volgende"
}
},
{
"inputName": "Previous",
"friendlyName": {
"en": "Previous",
"nl": "Vorige"
}
},
{
"inputName": "Adjust",
"friendlyName": {
"en": "Adjust",
"nl": "Adjust"
}
},
{
"inputName": "WatchTV",
"friendlyName": {
"en": "Watch TV",
"nl": "Kijk TV"
}
},
{
"inputName": "Viewmode",
"friendlyName": {
"en": "Viewmode",
"nl": "Viewmode"
}
},
{
"inputName": "Teletext",
"friendlyName": {
"en": "Teletext",
"nl": "Teletext"
}
},
{
"inputName": "Subtitle",
"friendlyName": {
"en": "Subtitle on/off",
"nl": "Ondertiteling aan/uit"
}
},
{
"inputName": "ChannelStepUp",
"friendlyName": {
"en": "Channel Up",
"nl": "Vorig kanaal"
}
},
{
"inputName": "ChannelStepDown",
"friendlyName": {
"en": "Channel Down",
"nl": "Volgend kanaal"
}
},
{
"inputName": "Source",
"friendlyName": {
"en": "Source",
"nl": "Source"
}
},
{
"inputName": "AmbilightOnOff",
"friendlyName": {
"en": "Ambilight on/off",
"nl": "Ambilight aan/uit"
}
},
{
"inputName": "PlayPause",
"friendlyName": {
"en": "Play / Pause",
"nl": "Play / Pause"
}
},
{
"inputName": "Pause",
"friendlyName": {
"en": "Pause",
"nl": "Pause"
}
},
{
"inputName": "FastForward",
"friendlyName": {
"en": "Fast Forward",
"nl": "Doorspoelen"
}
},
{
"inputName": "Stop",
"friendlyName": {
"en": "Stop",
"nl": "Stop"
}
},
{
"inputName": "FastBackward",
"friendlyName": {
"en": "Fast Backward",
"nl": "Terugspoelen"
}
},
{
"inputName": "Record",
"friendlyName": {
"en": "Record",
"nl": "Opnemen"
}
},
{
"inputName": "Online",
"friendlyName": {
"en": "Online",
"nl": "Online"
}
}
]