Blink(1) The Doctor is In Light

I just got my Blink(1) and because my office configuration makes it hard for people to see if I am there or not, I wanted to rig something up so that when I sign in to my computer it turns the light green.

Here is how I accomplished this:

I am running the current version of Blink1Control2, and I activated the server.

Now all I need is two small programs that can be called when the Lock and Unlock events fire.

Enter Node.js and node-libcurl - with them I was able to write two simple programs two flip the light to red and green. Here is the crux of the green light program:

var Curl = require( 'node-libcurl' ).Curl;

var curl = new Curl();

curl.setOpt( 'URL', 'localhost:9997/blink1/fadeToRGB?rgb=%2300FF00' );

curl.perform();

Think that's the real port? Guess again!

Lastly you just need a way to call these when you lock or unlock your computer (Windows 10 in my case).

This StackExchange/SuperUser article was very helpful in figuring that out.

After some quick debugging and testing, I locked and unlocked and the light turns red/green. Boom!

All told, it took about an hour, but most of that was figuring out how to plug the pieces together. I was not envisioning using Node to solve this at first, so that took me a minute.

That was some good fun. When I get it set up in my office I will post a picture of that also.

I don't love running the control program, but I think if I want to go deeper it will take more time and I think what I have will work.