JPersson77 / LGTVCompanion

Power On and Off WebOS LG TVs together with your PC
MIT License
992 stars 40 forks source link

Any way to turn off tv when the screen goes to sleep in windows power management? #40

Closed sonuyos closed 1 year ago

sonuyos commented 2 years ago

I have my Turn Off Display set for 3 mins, and then after 3 mins the screen goes to sleep, but the problem is that the LG Screensaver kicks in, what I want is that when the screen goes to sleep, it just shut down and when the mouse is moved that time the screen turns back on.

image

I can use screensaver mode? Yes, but i am using the screensaver mode at 1min interval after which i want the screen to go into sleep (after 15min) and tv to turn off.

JPersson77 commented 2 years ago

Hi there,

If I understand you correctly you are looking for what is already a core functionality in LGTV companion. If the display does not shutdown/power off when your PC turn off the displays something is not working as expected. Can you please enable the logging function in the settings for the app, then upload the log here or elsewhere and paste a link so I can take a look please. Preferrrably the entire log.

Kind regards Jörgen

tonycassara commented 2 years ago

Hi @JPersson77 I'm having the same issue, can you check my log?

Sun 12:26:25 > LGTV Companion Service started (v 1.7.0) ---------------------------
Sun 12:26:25 > Configuration file successfully read
Sun 12:26:25 > Data path: C:\ProgramData\LGTV Companion\
Sun 12:26:25 > Device1, [LG] webOS TV OLED42C2PUA, with IP 192.168.1.187 initiated (Enabled:yes, WOL:2, PairingKey:ad5888a4aec8680bf5892c184d1be633, MAC: 80:5B:65:8B:02:7C , VerifyHdmiInput:2, SetHdmiInput:2, BlankOnIdle:on(10m))
Sun 12:26:25 > Host IP detected: 192.168.1.76
Sun 12:26:25 > Setting shutdown parameter level 0x3FF
Sun 12:26:25 > ** System requests displays ON.
Sun 12:26:25 > Device1, spawning DisplayPowerOnThread().
Sun 12:26:25 > Device1, spawning DisplaySetHdmiInputThread().
Sun 12:26:25 > Device1, repeating WOL broadcast started to MAC: 80:5B:65:8B:02:7C using IP address: 192.168.1.187
Sun 12:26:25 > GetBestRoute2() selected interface index 14 LUID 19985273102270464 route protocol 2
Sun 12:26:25 > CreateIpNetEntry2() = 0
Sun 12:26:25 > DeleteIpNetEntry2() = 0
Sun 12:26:25 > IPC, Daemon has started.
Sun 12:26:27 > GetBestRoute2() selected interface index 14 LUID 19985273102270464 route protocol 2
Sun 12:26:27 > CreateIpNetEntry2() = 0
Sun 12:26:27 > DeleteIpNetEntry2() = 0
Sun 12:26:29 > GetBestRoute2() selected interface index 14 LUID 19985273102270464 route protocol 2
Sun 12:26:29 > CreateIpNetEntry2() = 0
Sun 12:26:29 > DeleteIpNetEntry2() = 0
Sun 12:26:31 > GetBestRoute2() selected interface index 14 LUID 19985273102270464 route protocol 2
Sun 12:26:31 > CreateIpNetEntry2() = 0
Sun 12:26:31 > DeleteIpNetEntry2() = 0
Sun 12:26:33 > GetBestRoute2() selected interface index 14 LUID 19985273102270464 route protocol 2
Sun 12:26:33 > CreateIpNetEntry2() = 0
Sun 12:26:33 > DeleteIpNetEntry2() = 0
Sun 12:26:35 > GetBestRoute2() selected interface index 14 LUID 19985273102270464 route protocol 2
Sun 12:26:35 > CreateIpNetEntry2() = 0
Sun 12:26:35 > DeleteIpNetEntry2() = 0
Sun 12:26:37 > GetBestRoute2() selected interface index 14 LUID 19985273102270464 route protocol 2
Sun 12:26:37 > CreateIpNetEntry2() = 0
Sun 12:26:37 > DeleteIpNetEntry2() = 0
Sun 12:26:39 > GetBestRoute2() selected interface index 14 LUID 19985273102270464 route protocol 2
Sun 12:26:39 > CreateIpNetEntry2() = 0
Sun 12:26:39 > DeleteIpNetEntry2() = 0
Sun 12:26:41 > GetBestRoute2() selected interface index 14 LUID 19985273102270464 route protocol 2
Sun 12:26:41 > CreateIpNetEntry2() = 0
Sun 12:26:41 > DeleteIpNetEntry2() = 0
Sun 12:26:43 > GetBestRoute2() selected interface index 14 LUID 19985273102270464 route protocol 2
Sun 12:26:43 > CreateIpNetEntry2() = 0
Sun 12:26:43 > DeleteIpNetEntry2() = 0
Sun 12:26:45 > GetBestRoute2() selected interface index 14 LUID 19985273102270464 route protocol 2
Sun 12:26:45 > CreateIpNetEntry2() = 0
Sun 12:26:45 > DeleteIpNetEntry2() = 0
Sun 12:26:46 > Device1, WARNING! SetDisplayHdmiInputThread(): connect: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
Sun 12:26:46 > Device1, WARNING! DisplayPowerOnThread(): connect: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
Sun 12:26:47 > GetBestRoute2() selected interface index 14 LUID 19985273102270464 route protocol 2
Sun 12:26:47 > CreateIpNetEntry2() = 0
Sun 12:26:47 > DeleteIpNetEntry2() = 0
Sun 12:26:49 > GetBestRoute2() selected interface index 14 LUID 19985273102270464 route protocol 2
Sun 12:26:49 > CreateIpNetEntry2() = 0
Sun 12:26:49 > DeleteIpNetEntry2() = 0
Sun 12:26:51 > GetBestRoute2() selected interface index 14 LUID 19985273102270464 route protocol 2
Sun 12:26:51 > CreateIpNetEntry2() = 0
Sun 12:26:51 > DeleteIpNetEntry2() = 0
Sun 12:26:53 > GetBestRoute2() selected interface index 14 LUID 19985273102270464 route protocol 2
Sun 12:26:53 > CreateIpNetEntry2() = 0
Sun 12:26:53 > DeleteIpNetEntry2() = 0
Sun 12:26:55 > GetBestRoute2() selected interface index 14 LUID 19985273102270464 route protocol 2
Sun 12:26:55 > CreateIpNetEntry2() = 0
Sun 12:26:55 > DeleteIpNetEntry2() = 0
Sun 12:26:57 > GetBestRoute2() selected interface index 14 LUID 19985273102270464 route protocol 2
Sun 12:26:57 > CreateIpNetEntry2() = 0
Sun 12:26:57 > DeleteIpNetEntry2() = 0
Sun 12:26:59 > GetBestRoute2() selected interface index 14 LUID 19985273102270464 route protocol 2
Sun 12:26:59 > CreateIpNetEntry2() = 0
Sun 12:26:59 > DeleteIpNetEntry2() = 0
Sun 12:27:01 > GetBestRoute2() selected interface index 14 LUID 19985273102270464 route protocol 2
Sun 12:27:01 > CreateIpNetEntry2() = 0
Sun 12:27:01 > DeleteIpNetEntry2() = 0
Sun 12:27:03 > GetBestRoute2() selected interface index 14 LUID 19985273102270464 route protocol 2
Sun 12:27:03 > CreateIpNetEntry2() = 0
Sun 12:27:03 > DeleteIpNetEntry2() = 0
Sun 12:27:05 > GetBestRoute2() selected interface index 14 LUID 19985273102270464 route protocol 2
Sun 12:27:05 > CreateIpNetEntry2() = 0
Sun 12:27:05 > DeleteIpNetEntry2() = 0
Sun 12:27:07 > Device1, WARNING! SetDisplayHdmiInputThread(): connect: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
Sun 12:27:07 > Device1, WARNING! DisplayPowerOnThread(): connect: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
Sun 12:27:07 > Device1, repeating WOL broadcast ended
Sun 12:28:15 > ** System requests displays OFF.
Sun 12:28:15 > Device1, spawning DisplayPowerOffThread().
Sun 12:28:36 > Device1, WARNING! DisplayPowerOffThread(): connect: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
Sun 12:30:46 > ** System requests displays ON.
Sun 12:30:46 > Device1, spawning DisplayPowerOnThread().
Sun 12:30:46 > Device1, repeating WOL broadcast started to MAC: 80:5B:65:8B:02:7C using IP address: 192.168.1.187
Sun 12:30:46 > GetBestRoute2() selected interface index 14 LUID 19985273102270464 route protocol 2
Sun 12:30:46 > CreateIpNetEntry2() = 0
Sun 12:30:46 > DeleteIpNetEntry2() = 0
Sun 12:30:48 > GetBestRoute2() selected interface index 14 LUID 19985273102270464 route protocol 2
Sun 12:30:48 > CreateIpNetEntry2() = 0
Sun 12:30:48 > DeleteIpNetEntry2() = 0
Sun 12:30:50 > GetBestRoute2() selected interface index 14 LUID 19985273102270464 route protocol 2
Sun 12:30:50 > CreateIpNetEntry2() = 0
Sun 12:30:50 > DeleteIpNetEntry2() = 0
Sun 12:30:52 > GetBestRoute2() selected interface index 14 LUID 19985273102270464 route protocol 2
Sun 12:30:52 > CreateIpNetEntry2() = 0
Sun 12:30:52 > DeleteIpNetEntry2() = 0
Sun 12:30:54 > GetBestRoute2() selected interface index 14 LUID 19985273102270464 route protocol 2
Sun 12:30:54 > CreateIpNetEntry2() = 0
Sun 12:30:54 > DeleteIpNetEntry2() = 0
Sun 12:30:56 > GetBestRoute2() selected interface index 14 LUID 19985273102270464 route protocol 2
Sun 12:30:56 > CreateIpNetEntry2() = 0
Sun 12:30:56 > DeleteIpNetEntry2() = 0
JPersson77 commented 2 years ago

Hi @tonycassara, is the issue that the app does not automatically turn on your TV, turn off your TV, or both? From the log it looks like both.

If so, you might want to start by double checking the IP and the MAC-address. Also, I assume you have followed the setup guide in the readme, but can you please confirm you have done this:

Ensure that the TV can be woken via the network. For the CX line of displays this is accomplished by navigating to Settings (cog button on remote)->All Settings->Connection->Mobile Connection Management->TV On with Mobile, and then enable 'Turn On via Wi-Fi'. For C1 and C2 it's All Settings->General->Devices->External Devices->TV On With Mobile->Turn on via Wi-Fi Then have a look at these troubleshooting steps:

When connecting the TV via Wi-Fi it seems some users must enable "Quickstart+" and disable "HDD Eco mode" to avoid the NIC becoming inactive. (physical network cable does not seem to need this) Try reconfiguring the device and use one of the other wake-on-lan network options, primarily use option two, connect using an IP adress but it's worth testing the other. Ensure the network is not dropping WOL-broadcasts.

Let me know if none of the above helps

tonycassara commented 2 years ago

@JPersson77 oh my gosh soooo I forgot I changed the wifi password and didn't update the TV's password... duh. It works great now! Thank you for such an awesome tool!

JPersson77 commented 1 year ago

Closing issue due it being resolved