Hi, all. I just came up with a solution for a problem (with a bit of help from this community and the internet) that I thought I’d share in case others were facing a similar challenge.
I want the LED light on the back of my monitor to turn off when I lock the workstation or put it to sleep, and I want it to come back on when I turn unlock it (after waking it from sleep or otherwise).
So I plugged the LED strip into a Z-wave Miniplug outlet, set it up in OpenHAB, then created a couple of triggers in Windows Task Scheduler. The “On” task uses the following settings:
General:
- Run whether user is logged on or not (you have to enter your password when saving the task)
- run with highest privileges
Triggers: On Workstation unlock (of your main user only to prevent foul play)
Actions: Start a program - run a batch file with the following command:
curl -X POST --header "Content-Type: text/plain" --header "Accept: application/json" -d "ON" "http://server:8080/rest/items/MiniPlug1_Switch"
(obviously you need to have curl for windows installed)
Then set up a similar task for turning it off, changing Triggers to “On Workstation lock”, and then point it to a batch file similar to the above but with the parameter changed to “OFF”:
curl -X POST --header "Content-Type: text/plain" --header "Accept: application/json" -d "OFF" "http://server:8080/rest/items/MiniPlug1_Switch"
Have fun!