Home key does not work but live tv does? #110
-
This works... TV.connect()
.catch(console.error); But this does not work... TV.connect()
.catch(console.error); AssertionError [ERR_ASSERTION]: key must be valid The home key is defined in the keys enumeration, so not sure why it is not a valid key. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
How do you reference and exported enum? const { LGTV } = require('lgtv-ip-control'); Object.keys(Keys).forEach(key => console.log("Key:", key)) Object.keys(Keys).forEach(key => console.log("Key:", key)) ReferenceError: Keys is not defined |
Beta Was this translation helpful? Give feedback.
-
Figured it out... the Key 'home' is NOT 'home' but 'myapp'... So your documentation (read me) is in error 'home' = 'myapp' NOT 'home'='home'. Guess the key should be named 'myapp' to be descriptive as to its true value? However, at least on my LG TV, 'myapp' returns "This button is not available", so not sure what string value will actually engage the Home button? |
Beta Was this translation helpful? Give feedback.
-
This is a common practice with JavaScript constants, where the property name has a "human readable" value, and the property value has the actual expected machine value. So basically you have the convenience name that resolves to the actual value: const { LGTV, Apps } = require("lgtv-ip-control");
console.log(Apps.youtube);
// Resolves to "youtube.leanback.v4" That's why |
Beta Was this translation helpful? Give feedback.
-
Yeah, I am or was having Node Red reference the exported keys lists... but your example illustrates how to do it. Still learning JavaScript. or should I say TypeScript. |
Beta Was this translation helpful? Give feedback.
This is a common practice with JavaScript constants, where the property name has a "human readable" value, and the property value has the actual expected machine value.
So basically you have the convenience name that resolves to the actual value:
That's why
Apps
,Inputs
, etc. are exported for you to use.