node-red-contrib-lgtv icon indicating copy to clipboard operation
node-red-contrib-lgtv copied to clipboard

Subscribe to power states?

Open rcarmo opened this issue 6 years ago • 10 comments

I can’t seem to be able to be notified when the TV is turned off. The homebridge webOS plugin seems to do that by poking at the port, but it would be nice to have an event made available to Node-Red.

rcarmo avatar Nov 03 '18 23:11 rcarmo

The control node should output the current connection state as boolean payload.

hobbyquaker avatar Nov 04 '18 17:11 hobbyquaker

And will the node issue that when the connection is closed (I assume that will be when it goes on standby) even if I never issued a command?

rcarmo avatar Nov 04 '18 18:11 rcarmo

yes, it should

hobbyquaker avatar Nov 04 '18 18:11 hobbyquaker

Well, I’ve had to resort to polling the TV on port 3000 and generating my own event from when it goes away or comes back - the control output isn’t flexible enough, because I need to send out a command to the TV to get an updated result back...

rcarmo avatar Nov 04 '18 21:11 rcarmo

My tv (C8) it will almost always return true. I get no message when I hit the power button on the remote :( Also, in this state I am able to wake it up by sending the POWER button through the button node. After a while the TV will go to deeper sleep where only the WOL packet will wake it up from.

Any way to detect these power states?

andrasg avatar Feb 10 '19 20:02 andrasg

I confirm that the node sends only the "true" status, "false" does not receive. Please fix this so that both statuses work.

cacherocks avatar Aug 23 '19 22:08 cacherocks

+1

marcelismus avatar Jul 06 '20 05:07 marcelismus

Hello,

I also use contrib-lgtv and have the problem that after switching off the TV with the IR remote control and then switching the house to sleep, the device comes on again. This is done with the "turnOff" command in alternation ... on / off / on / off ... it works for a few minutes, then the TV falls into deep sleep. How can I do that? The status is only toggled using the "Request" function with the URL "ssap: // system / turnOff".

Thank you in advance!

smartprohome avatar Nov 08 '20 19:11 smartprohome

hello again, I recognized the problem and was able to find a solution for myself. New TV's have a setting in the menu that allows the TV to be switched on via an app. In the original LG app, there is only one button called "Switch off TV". This button toggles the on / off state if the setting in the TV's menu allows it to be switched on via apps. The TV remains permanently accessible via ping, as soon as the setting has been switched off, the node or ping is disconnected after approx. 30 seconds.

Problem solved.

smartprohome avatar Nov 09 '20 19:11 smartprohome

Bit of a late response, but for whomever is interested:

I noticed this issue too. Turns out, there TV broadcasts an empty appId string when the TV is powered off. This package checks whether the appId is defined, and if it's not, it does not broadcast anything further. This fixes it for me:

https://github.com/DiederikvandenB/node-red-contrib-lgtv/commit/67ef73de04d9f4cb74fd588cefeef338eb7b3bf8

You can use my package by running npm install DiederikvandenB/node-red-contrib-lgtv, but be aware that I deleted a lot of nodes that I was never going to use anyway. If you do still need those, just fork this repo and apply the fix yourself.

DiederikvandenB avatar Jun 29 '22 14:06 DiederikvandenB