Closed samepaul closed 1 year ago
Hi @samepaul this is not something I've noticed. Can you confirm you mean this issue occurs when shutting down the system?
How do you know when windows actually turns off the displays?
Generally (if we're talking about the system shutting down) the application responds to a SERVICE_CONTROL_PRESHUTDOWN and takes appropriate action. Typically there is no power message (PBT_POWERSETTINGCHANGE) after that to which the app can respond. The app could respond to SERVICE_CONTROL_SHUTDOWN instead but that would leave less time to ensure the TV is powered off.
Can it be that you have some other program delaying your shutdown, which needs to be looked at? If you are shutting down the system then the TV will power off as soon as possible (by design) so if there are some program preventing shutdown, you will not see it (unless you reach for the remote and power the TV back on)
It is not shutdown. It happens when I don't touch my PC for a while. I have "turn off my screen" in Windows Settings being set to 5 minutes, so after 5 minutes happens what I described - turns off my TV and then 10-30 seconds later my 2 other displays. I have 3 monitors in total, that's how I know. The delay is somewhat random and seems depends on the setting mentioned above. Not sure, didn't have patience to test with longer settings, but for 1 minute all monitors and TV turn off almost simultaneously, for 3 minute the TV was ~10 sec ahead, for 5 minutes almost 20 sec. I am pretty sure Windows has changed some of the power management mechanics under the hood, because before the 22H2 update everything worked perfectly.
here example video: https://youtu.be/_FSsbRoe9z4
If there any technical information/logs/etc I can provide or some experiments to do, please tell me what exactly, I will try my best to collect.
Thanks for the details and the video! Do you by any chance use a laptop or stationary with modern standby? Please enable logging and paste a log at pastebin or similar and paste the link here and I will have a look
hi @samepaul any inpu wrt the above?
hi, sorry, missed your comment. No, it is not laptop and it does not support modern standby. Regular desktop PC. The log was very short, so I guess can paste it here :)
Fri 16:58:40 > LGTV Companion Service started (v 1.8.0) ---------------------------
Fri 16:58:40 > Configuration file successfully read
Fri 16:58:40 > Data path: C:\ProgramData\LGTV Companion\
Fri 16:58:40 > Device1, LGwebOSTV.lan, with IP 192.168.2.181 initiated (Enabled:yes, WOL:2, PairingKey:*****, MAC: 58:FD:B1:B1:A2:70 , VerifyHdmiInput:1, SetHdmiInput:off, BlankOnIdle:off)
Fri 16:58:40 > Host IP detected: 192.168.2.100
Fri 16:58:40 > Setting shutdown parameter level 0x3FF
Fri 16:58:40 > System requests displays ON.
Fri 16:58:40 > Device1, spawning DisplayPowerOnThread().
Fri 16:58:40 > Device1, repeating WOL broadcast started to MAC: 58:FD:B1:B1:A2:70 using IP address: 192.168.2.181
Fri 16:58:40 > GetBestRoute2() selected interface index 10 LUID 1689399733518336 route protocol 2
Fri 16:58:40 > Device1, established contact: Display is ON.
Fri 16:58:42 > Device1, repeating WOL broadcast ended
Fri 17:01:42 > System requests displays OFF(DIMMED).
Fri 17:01:42 > Device1, spawning DisplayPowerOffThread().
Fri 17:01:42 > Device1, HDMI1 input active.
Fri 17:01:42 > Device1, established contact: Device is OFF.
Fri 17:01:57 > System requests displays OFF.
Fri 17:01:57 > Device1, omitted DisplayPowerOffThread().
Fri 17:02:09 > System requests displays ON.
Fri 17:02:09 > Device1, spawning DisplayPowerOnThread().
Fri 17:02:09 > Device1, repeating WOL broadcast started to MAC: 58:FD:B1:B1:A2:70 using IP address: 192.168.2.181
Fri 17:02:09 > GetBestRoute2() selected interface index 10 LUID 1689399733518336 route protocol 2
Fri 17:02:10 > Device1, established contact: Display is ON.
Fri 17:02:11 > Device1, repeating WOL broadcast ended
So there is something interesting in the log. I see that your PC sends out a "display OFF (dimmed)" 15 seconds before "Display off". This is usually something you'd expect to see on devices supporting modern standby (typically laptops) where the screen is dimmed down a little before shutting off. Hence my initial question. The app seems to be working according to design, but the question is why your PC apparently and suddently supports modern standby (at least I think so) and if it is connected to the windows update you mentioned. Can you describe the hardware of your PC a bit more detailed (if you know)? In particular the motherboard and CPU.
Here's some information I found about modern standby, a k a known as S0, which seems relevant. Maybe you would be interested in checking if "powercfg /a" reports that your system is S0 capable?
Well, your guess is wrong, modern standby is not supported. I have checked this topic quite long time ago, coz I wanted S0 :) But no, only regular S3-S5.
powercfg /availablesleepstates
The following sleep states are available on this system:
Standby (S3)
Hibernate
Hybrid Sleep
Fast Startup
The following sleep states are not available on this system:
Standby (S1)
The system firmware does not support this standby state.
Standby (S2)
The system firmware does not support this standby state.
Standby (S0 Low Power Idle)
The system firmware does not support this standby state.
Yes I know, I've built my PC. MB: Asus Prime Z690m-plus D4 CPU: i5 12600kf
Thanks, that is interesting. I don't think I have ever seen the dimmed state in all the logs I have reviewed (except when testing it initially on my laptop). I will research it a bit more because honestly I don't remember why I chose to turn the displays off on the "dimmed" message if present, although I'm confident there WAS a reason since I mapped it quite carefully at the time
Would you agree this is probably the cause of the issue you are seeing?
Yes, it looks like there are 2 "display off" events and what you described about dimming indeed feels familiar to what I've seen on my work laptop. And timing feels matching. If you had reason for choosing 1st event over 2nd, I won't request completely change behavior, but could you please make this choice configurable? Something like checkbox "ignore dimming event"?
I think I remember (disclaimers apply) that I chose this behaviour because 1) the researched assumptions showed that dimmed state kicks in at the time set in the windows control panel to turn the displays off and 2) a "display power on"-event will be triggered even after a "display dimmed" state.
But now I'm leaning towards changing this behaviour (if it does not cause ill effects).
Btw, do you have somehintg like this in your power options:
Nope, only this:
But it doesn't mean anything, I bet Microsoft does lot of stuff under the hood. Like I said at the beginning, everything was working great until I upgraded Windows last year.
Yeah absolutely. "If it works don't mess with it!" is merely a suggestion ;)
I'll see if I can change it to omit the "dimmed" state without wreaking havoc
Hi, I've looked a bit at this and unfortunately I cannot disregard the dimmed event. For some reason, only microsoft knows, when a normal windows screensaver is running only the dimmed event will be sent when the display should power off (turn off screen after X minutes) . So disregarding the dimmed event will cause the display to not power off when a windows screensaver is running.
I will keep this topic open as I'm still thinking if there is a good way to workaround
can you make an option in configuration? i could try eng build to see if it actually helps
I can't think of a way to add it as an option in the UI so that it wouldn't be confusing to users. I can however think about adding it as a switch to f o be added manually to config.json (for those who know about it) or, preferrably, I can try to figure out a way to make it work regardless.
What the problem? Add checkbox "Ignore dimming event" and that's it.
Maybe, but I don't think an average user of the app has no idea what a "dimmed" event is. I'll consider it
Average user of your app has no clue about 80% of items in "Additional options" :)
"restart words"?
"user idle mode management"?
Why it is needed? (rhetorical question, no need answer)
yet you have it there. And I think you already found elegant solution with "what's this?" link. Add few more lines into popup of "advanced power options and enhanced burn-in protection" and that should be good enough for average user :)
Yeah that is a fair point. :) Still there is a possibility of a fully automated solution, which I'd prefer.
The only corner case (that I'm aware of) is when the windows screen saver has been triggered. I think the logic can be changed to use the dimmed event in case the screen saver is running, or otherwise the "normal" event.
What do you think about that?
oh sorry missed your question. I cant say i fully understand your proposal. I don't think that screensaver activation should trigger TV power off. As well as dimming should not. Only proper "display turn off" should do the same to TV. In any case i can be your guinea pig to check if your solution works or not. :)
Hi @samepaul this should be fixed in v3.1.9. let me know how it goes please and/or feel free to reopen the issue if needed
Sorry for late replay, was on lengthy travel. Just tested it and it works. Especially amazing that it required zero configuration from my side. Awesome work, sir!
After installing 22H2 update couple month ago LGTV Companion suddenly started work bad, it tuns off TV ~30 sec before Windows actually turns off displays.
The issue is not critical of course as it generally works, but not clear why this happens