hobbyquaker / lgtv2

Control LG WebOS TV using node.js :tv:
MIT License
334 stars 44 forks source link

Reliable way to determine the TV's power status (on/off)? #12

Closed twistedpixel closed 6 years ago

twistedpixel commented 6 years ago

Just wondering if you know of a good way to check this? Might be a good feature to add.

I've tried various endpoints through the websocket but it responds happily to them even when the TV is off. I also tried sending ICMP packets to see if it would reject them when off but no luck.

Any ideas?

hobbyquaker commented 6 years ago

Just add event handlers to the connect and disconnect event. Disconnect comes nearly instant, connect takes 10-20 seconds, the ethernet port and the websocket listener take some time to start (you see that when you try to go to the webos menu immediatly after switching on the tv, then it tells you you have to wait until the "smart services" are started)

twistedpixel commented 6 years ago

Interesting, I'll give it a shot; thanks for the tips!