I'm attempting to automatize lights around the man cave, ideally i would like to have the lights to be on as long as the computer screens are on and the lights go off when screensaver kicks in, without using any additional resident software.
So far i managed to catch events 4802 (screensaver start) and 4803 (screensaver stop) and using task scheduler and curl script to fire http request to the machine that handles the lights, and it works, to an extent.
Problem is that whenever the machine enters low power state, screensaver gets killed and 4803 is logged, and i can't differentiate between screensaver being killed by user input or by the windows entering low power state.
Basically i need to catch some events that happen when the screens turn off and on. Is there anything (in generic win7 installation) i could hitch the task on to?
Thanks.
EDIT:
I apologize to people who already answered this question, my question was not worded clearly enough. The machine in question does not actually enter sleep state, hence there is no event 42(kernel-power) or event 1(power-troubleshooter) generated in event logs, the machine only enters some kind of low-power state where it consumes about 53W, instead of the usual 180W, while i could use this to track the power state of this one specific machine, i would not be able to use the same method of detection for the other 3 computers in the room, since they do not have the required hardware (UPS) connected to them.
What i am looking for, is events that occur whenever monitors of the computer are powered off and back on by windows (not by their respective power buttons) as a result of the windows power management. Basically anything that would allow me to synchronize the lights in the cave with the state of the monitors and allow the task scheduler to fire off script that manipulates the lights.