Adventures in automating unchangeable apartment lights
For the last year or so, all of my lamps have used Hue bulbs, which means I can use my phone (via HomeKit) or Alexa to turn them on or off, change their brightness, and so forth. However, my apartment has some overhead lights in the kitchen area that are not easily replaceable with anything standard. Though I did try:
Living in an apartment, I also can’t replace my light switches with any of those fancy electronic IoT-ish switches, so I just let the problem be.
I finally tired of having three lights that didn’t respond, so I set out to solve the problem My requirements were the ability to control my lights via both Alexa and HomeKit, like the rest of my lights.
As far as I can tell, there is exactly one product on the market that is compatible with the my lights: Switchmate. It completely avoids the problem of replacing lights, switches, or indeed anything at all by just physically actuating the existing light switch. It is, by far, the easiest thing to install:
Unfortunately, beyond being compatible with my lights, it solves none of my problems. It isn’t compatible with Alexa, and it isn’t compatible with HomeKit. It promises voice control, but what that really means is that you can tap a microphone button in the app and then speak to your phone. This isn’t really very useful. In fact, as advertised, this product is pretty useless — though it’d be pretty neat if it was the only approximation home automation I had. What it does offer by virtue of having a mobile app, though, was opportunity. They communicate with their mobile apps via Bluetooth LE, and we can emulate that and thereby control them. Conveniently, people have already done this.
So I ordered the parts I would need and set out to make it work:
Three Switchmate BLE switches (two of them the slim/”bright” versions, because the older ones won’t fit side by side on two-gang switches)
One Raspberry Pi 3 model B+ — though I’m pretty sure the Pi Zero W would’ve worked as well, it didn’t have same-day shipping, and I am impatient.
A micro-SD card to put in the Pi
And… that was it. Total cost around $140, but it could’ve been closer to $100 if I were more patient.
Once I received them, I upgraded their firmware to the latest version using the mobile app, snapped them over the relevant switches, and got to making the promised integration happen.
On the software side, I installed the latest Raspbian on the Raspberry Pi, then grabbed a handy Python switchmate tool someone had written (which as far as I can tell is the only up-to-date implementation) to see if it would talk to my switches — and it did! I could experience the joy of turning my kitchen lights on and off from the command line.
Excellent! So now I’m exactly where I was with the phone app, except everything is slightly more inconvenient. But I have my proof of concept, and I can get to work on integration.
For this, I turned to a wonderful project called Homebridge, which lets you add arbitrary devices to Apple’s HomeKit and basically do whatever you like in response to whatever devices you choose to present. There are actually multiple homebridge-switchmate type plugins… but they’re all outdated and won’t necessarily do anything on recent hardware. I instead used homebridge-cmdswitch2 to expose command invocations as HomeKit switches. I simply had it invoke the previous python switchmate tool with the appropriate arguments whenever I needed to throw the switch. This was fine, except that I it needed root permissions. Being lazy, and in flagrant violation of anything ever resembling good practice, I just ran homebridge as root, and everything was good.
This worked! Sometimes. Except when it didn’t. And then it would just stop working entirely no matter how much you tried. In the end, I ended up writing a (terrible, terrible) script that retried several times, and reset the bluetooth stack before each attempt. Apparently the Pi’s integrated BLE does not play nice. For those interested, the script I wrote is over here.
With these retries, the HomeKit integration became reliable, and so I could proceed to the final task: Alexa integration. Conveniently, this has also already been solved by a plugin called homebridge-alexa, which publishes your Homebridge devices for Alexa’s consumption. After setting that up, it worked!
The initial fade-in is the Hue lamps turning up, followed by the three binary switches being thrown. It’s certainly slower, but it beats them being uncontrollable. And you get very satisfying whirring and clicking noises!
Switchmate is the world’s first smart light switch that instantly snaps over your existing light switches to bring voice controlled smart lighting into your home, all without having to replace or rewire a light switch or light bulb. Taking…
Switchmate rolls out the SimplySmart Home concept for better living
We all love the idea of convenience and our fingertips, which is why having a home that gets smarter by the day is just the thing that many people are looking for these days. Switchmate revels in the thought of working with connected home products wirelessly through the simple to install and activate SimplySmart Home. The whole point of the SimplySmart Home is to create a modern, automated home without ... http://dlvr.it/QJDFWN
Switchmate rolls out the SimplySmart Home concept for better living
Switchmate rolls out the SimplySmart Home concept for better living
We all love the idea of convenience and our fingertips, which is why having a home that gets smarter by the day is just the thing that many people are looking for these days. Switchmate revels in the thought of working with connected home products wirelessly through the simple to install and activate SimplySmart Home. The whole point of the SimplySmart Home is to create a modern, automated home…
So now we have a "smart" fireplace. If you want smart lights but are unimpressed with smart bulbs and unwilling to replace your switches, this might be an option for you. But we went this way for other reasons. Originally, I was planning on getting around to installing a Z-Wave relay for the low-voltage DC control circuit for the fireplace, but then I saw this funny little Switchmate gadget at Home Depot. It attaches magnetically to a switch and uses a motor to flip a switch -- so no hardware installation at all. It connects via Bluetooth LE to phones. Apparently Alexa support is coming in the future by way of a hub that will have support for other ecosystems too. Its origins are IndieGoGo, by the way.
So now we have a "smart" fireplace. If you want smart lights but are unimpressed with smart bulbs and unwilling to replace your switches, this might be an option for you. But we went this way for other reasons. Originally, I was planning on getting around to installing a Z-Wave relay for the low-voltage DC control circuit for the fireplace, but then I saw this funny little Switchmate gadget at Home Depot. It attaches magnetically to a switch and uses a motor to flip a switch -- so no hardware installation at all. It connects via Bluetooth LE to phones. Apparently Alexa support is coming in the future by way of a hub that will have support for other ecosystems too. Its origins are IndieGoGo, by the way.
So now we have a "smart" fireplace. If you want smart lights but are unimpressed with smart bulbs and unwilling to replace your switches, this might be an option for you. But we went this way for other reasons. Originally, I was planning on getting around to installing a Z-Wave relay for the low-voltage DC control circuit for the fireplace, but then I saw this funny little Switchmate gadget at Home Depot. It attaches magnetically to a switch and uses a motor to flip a switch -- so no hardware installation at all. It connects via Bluetooth LE to phones. Apparently Alexa support is coming in the future by way of a hub that will have support for other ecosystems too. Its origins are IndieGoGo, by the way.