H
HASS.Agent2mo ago
sensitive-blue

Monitor wakeup odd behaviour

Hello, I'm having some trouble using HASS.Agent's monitor wakeup command. Here's some context, please ask if I missed something, sorry for the wall of text. What I'm trying to achieve: Protect my OLED panel from burn-in by putting it to sleep when I step away from my desk and turn it back on when I return, without affecting the current task at hand (most likely a game that's running). My setup: My monitor has a built-in KVM switch with all peripherals connected directly to the monitor. I have a Everything Presence Lite with Zone configured to detect occupancy at my desk. I have WoL configured in Windows and BIOS, fast startup disabled and hybrid sleep disabled through group policy. Automations setup in Homeassistant to sleep/wakeup the monitor based on Zone presence. What works: I did a test for this and it works perfectly when I had a YouTube video playing in full screen. I am able to sleep and wake the monitor. What doesn't work: When I have some (Red Dead Redemption 2) game running, wakeup doesn't work. What I've tried that hasn't worked: Using key and multikey command to send key code 124 (F13 key). Using WoL to send a magic packet. Turning the monitor off and on. What I've tried that has worked: Switching my keyboard from cable to 2.4GHz wireless mode with the dongle connected to the PC and pressing a key (I have to do this because my Keyboard turns off with the monitor). Clicking somewhere on my second monitor before the monitor is put to sleep so that the game is not in the foreground anymore (active window shows as Program Manager rather than Red Dead Redemption 2). My best guess: HASS.Agent does monitor wakeup using a key press input which is eaten up by the game when it is in the foreground. I think this is the case because the Windows (Super) key also doesn't work when I'm in the game, unless I click somewhere on the second monitor before pressing it. Is there some solution to this that can be automated? Thanks in advance for any suggestions.
2 Replies
Amadeo
Amadeo2mo ago
is it possible that the device is going to "modern sleep" when you turn off the monitor? playing yt video causes the browser to acquire the CPU wakelock (preventing the device from any form of sleep) and from my experience wireless keyboards/mice do the same that would explain it
sensitive-blue
sensitive-blueOP2mo ago
Thanks for the response. I don't think this is the case, because the wakeup works fine even when the system is completely idle. It works for pretty much everything else I've tested other than this one game. I'm not sure if this is related but the game is launched as admin, maybe that affects something? I have however found a bit of a workaround. I have no knowledge of Windows scripting tbh, but I have a PowerShell script with
(New-Object -ComObject shell.application).toggleDesktop()
(New-Object -ComObject shell.application).toggleDesktop()
which I've added as a scheduled task and triggered through HASS.Agent as a command. If I trigger this before putting the monitor to sleep, then it wakes up just fine when the game is running. I really would like to understand why this is happening though.

Did you find this page helpful?