hobbyquaker / node-red-contrib-lgtv

Node-RED Nodes to control LG webOS Smart TVs :tv:
http://flows.nodered.org/node/node-red-contrib-lgtv
MIT License
59 stars 22 forks source link

Persistent connect, how-to? #16

Closed nonkronk closed 4 years ago

nonkronk commented 4 years ago

The node needs to be connected manually each time the node-red service restart, e.g. after power outage, (i have to open node-red editor, click node, click connect, click update, and click deploy) Otherwise, the remote cards that i made on hass will not work. Is there any solution to solve this particular problem?

hobbyquaker commented 4 years ago

which webOS version does your TV have? I fear this is ab Issue with newer webOS version (4.x?), I dont have that issue on my 4y old TV which has webOS 2 or 3 iirc... So I‘m kinda clueless because I cant test that myself... Is there any useful log output?

Misunderstood... The Issue is not that you have to accept the connection on the TV again - it's completely on Node-RED side, right?

I guess that saving and/or loading the Token doesn't work. This is done via Node-REDs encrypted credential store:

I would suggest to set Node-REDs Log level to debug and check if there is any log output related to credentials or encryption that could point us in the right direction.

nonkronk commented 4 years ago

Problem solved! I turned the log level to debug mode, Apparently, we have to provide a key on credentialSecret property in settings.js to encrypt our credentials with the chosen key. (i've never check the log before)

credentialSecret: "random-string"

By default Node-RED generates a random key for the encryption.