Every year we seem to buy a bigger Christmas tree. This year is no exception and it is now proving difficult to maneuver around it to turn the lights on and off. To fix this, I’ve connected my lights up to a Belkin WeMo and I’m running the excellent Homebridge1 server so that I can control it all via Siri:
To get this up and running on your own machine, you’ll need to do the following in the Mac Terminal:
This will install brew, install node, install Homebridge, install the WeMo plugin for Homebridge, and then attempt to run Homebridge (which will fail as you have no config file). Next, you’ll want to go to
~/.homebridge and create a config.json file that looks like this:
The important part is to make sure that the
wemo_name matches the name of your device within the WeMo app; the
name attribute is what you want your device to be called on HomeKit. Run the
homebridge command again and you should see that your device is found and Homebridge is running.
Next, you’ll need to get a HomeKit enabled app to run all of this. My recommendation is to use the one that Apple provides to developers, HomeKit Catalog, although that will require you to know how to sideload apps from Xcode. Alternatively you can download the Elgato Eve app. Once you have an app, you’ll need to add the Homebridge using the pin that is in your config file. You can play around with the app and create rooms, scenes, zones, etc, but for now the basic commands should work. If you can turn your device on and off via the HomeKit enabled app, you will be able to activate Siri and say “turn on the Christmas tree”, “turn off the Christmas tree”, and “is the Christmas tree on?”.
Added bonus: if you have an Apple TV, you are signed into iCloud, and you use iCloud keychain, then you’ll be able to use all of these voice commands when you’re outside of your house! It’s a pretty useful way to activate these devices and I have several of them dotted around my home2. Homebridge also supports many other services such as Philips Hue (without the need for their HomeKit bridge) and you can write your own plugins very easily3.
My next task is to dig out some code I wrote last year to turn the tree lights on and off automatically depending on if I’m in the house using an iBeacon…
After my wife asked me for the 62nd time if she’d left her straighteners plugged in whilst we were driving in the car, I set up the plug near her dresser with a WeMo so she can use Siri to ask “are my straighteners turned on?” and “turn off the straighteners” if need be! ↩︎