Skip to main content

2014

Synchronizing a ZWave lamp with monitor power state in Windows 8+

It's nice to have three monitors for a lot of screen real estate but the lights from the screens can often be overwhelming, especially at night. I installed a 3 x 10-inch LED strip behind the monitors which give a nice ambient light behind the screens.

I wrote a very simple app, vera-monitor-backlight, that runs in the background and watches system monitor state in Windows 8+. When the monitors turn off, it sends a command to Vera to turn off the light. When the monitors come back on, the backlight is turned on again. The code is hosted on Github.

Tested with a VeraLite home automation controller. You will likely need to change the IP address and DeviceNum parameters in the OnUrl and OffUrl variables to match your setup.

Also serves as an example of how to use RegisterPowerSettingNotification, GUID_CONSOLE_DISPLAY_STATE, WM_POWERBROADCAST, and PBT_POWERSETTINGCHANGE, and POWERBROADCAST_SETTING in C#.

vera-monitor-backlight on Github