Recently I've found myself dabbling in some basic home automation for lighting and control. I've had pretty decent success with the Belkin Wemo line of products and more recently I've enjoyed using their light bulbs on their Wemo Link platform.
Here's my problem: I have these Wemo controlled LED light bulbs and they work fine with Belkin's Wemo control app, but it was "disconnected" from the rest of my living room experience. Sure, I could use my iPhone to control the lights, but I've been a long time Logitech Harmony Remote user. My Harmony Remote controls my home theater and basically every device in my living room except for my Belkin Wemo lights. This seemed like something that should go hand in hand? When I want to watch TV I might want to dim the lights or turn them on using the same remote I use to turn on my TV.
Now you can program practically any Infrared device into the Logitech Harmony Remote, but the fundamental flaw here is that the Wemo Link, which controls the LED bulbs is not Infrared.
I had to hack together a few different services, applications, and scripts together, but I've achieved the ability to control my Wemo Link LED lights with my Harmony Remote. Let me first preface this by being the first to say that this is a very convoluted "Rube Goldberg" like way to turn on a lightbulb.
There are 3 main parts to make this work.
- Logitech Harmony's Windows Media Center "Special Edition" Device
- AutoHotKey
- cURL
- IFTTT and their Maker Channel
Here's how it all works together:
With the expanded Windows Media Center functionality offered by the "Special Edition" device in Logitech's Harmony Device Database it allows you to map custom buttons to send my Home Theater PC hotkey commands such as ALT+1
ALT+2
and so on. Since the HTPC will receive these commands via IR that solves the IR issue. Now we just have to get those hotkey commands to some how trigger the Wemo bulbs.
The Maker Channel from IFTTT allows you to trigger recipes via a HTTP POST request which you can easily do with cURL. In IFTTT one of the actions you can do is interact with Belkin's Wemo Bulbs. Now things are coming together. All we have to do now is use cURL to send a POST request to IFTTT to turn the bulbs on, off, or dim them.
A simple Windows batch file is needed for this. Let's call it LightsOn.bat:
Where {LivingRoomLightsOn}
is the Event Name that corresponds to what I've specified in the IFTTT Recipe. I just needed to make a batch file and IFTTT recipe for each of the actions I needed (Lights on, Lights Off, Lights Dimmed to %20, and Lights at full brightness).
Here's the one for turning the lights on:
So now we have a way to send hotkey commands to my Home Theater PC via IR from the Logitech Harmony Remote and we have a way to trigger the Wemo Lights. We just need to connect these two things together, we're almost there!
AutoHotKey is one of those utility applications I'm surprised I haven't played around with sooner. It seems to be a pretty unique and easy way to script some powerful functions surrounding hotkey shortcuts in Windows. I'll probably find another use for it in the future, but here's how it helps with my Home Automation problem:
We need to get the hotkey ALT+1
to execute LightsOn.bat
. Easy!
Create a new .ahk file and put in !1::Run C:\Path\To\Bat\LightsOn.bat, C:\Path\To\Bat , hide
save it and run it.
In AHK the !
is treated as ALT
so the !1
represents ALT+1
. Anything to the Left of the two colons is what the hotkey will do. In this case it will run my bat file. Using the hide
switch in the AHK Run command will execute the command in a hidden state which is useful, without it you'll see a nice black command prompt window interrupt your TV watching experience.
That's it! We have the Logitech Harmony Remote sending the command ALT+1
from a custom button which the HTPC accepts and executes a batch file that sends an HTTP POST request to IFTTT triggering my Belkin Wemo Lighting bulbs (what a mouthful).
There's a few seconds of delay to get the HTTP Request from and back to my home across the internet and using the internet itself for this is surely very inefficient, but it works. I didn't have to purchase any special hardware to connect the two incompatible platforms together either.
Overall this was a great project that took a bit of creativity to get it to work. Using this exact same method you can program your Harmony remote to perform other non IR devices that leverage IFTTT such as controlling a Nest Thermostat, Phillips Hue, Twitter, whatever you might want to do while watching TV.
Check out my other posts on Home Automation and other Smart Home technologies here!
Buy me a coffee