Extending Apple’s homekit through Homebridge

I’ve been doing a lot of weekend house projects lately. I started with hours on YouTube watching videos on how to wire up wall switches because I wanted to control more lights on my network.

I followed the Wirecutter’s roundup of the best IoT wall switches and jumped on their cheap pick, the Kasa HS200 wall switch since it didn’t need a hub like the more expensive models. I ordered a few last week and had them ready to go.

It took me two full afternoons to wire up my first switch in the garage because I screwed up the neutral wire connection but in the process learned how to read wiring diagrams and appreciate why a neutral wire is a key part of home circuitry. So after days of research and trying over and over, I finally got my light switch working.

I had to install a custom Kasa app, put the switch on my network, and could turn it off and on from my phone. Next, I wanted to add this to Homekit so I could add it to everything else in my house. I checked the settings screen, but couldn’t find any way to connect to Homekit. Worse, a quick Google search showed me that TP-Link, the makers of Kasa switches recently decided to abandon development of Homekit compatibility even though they announced it as “coming soon” at CES in January.

I went back to check the Wirecutter post and I guess I didn’t it read closely enough because though they mention Homekit support in every other pick, and they only say the Kasa switch works in iOS, without specifically mentioning Homekit. Which it does not support.

Oh bother.

Several comments on the Verge said “Just use Homebridge, I bet someone already wrote a tp-link plugin for it.”

I’d heard of this hack for Homekit called Homebridge and when I searched, lo and behold, there was indeed a tp-link plugin to add the light switch to Homekit that I spent all weekend installing. But could this really work?

Automation that turns on the lights in the garage when the garage door opens after sunset or before sunrise

I opened a terminal to the Raspberry Pi I use for running Pi Hole (it filters all ads from my entire network) and I followed these instructions to install Homebridge. It took about five minutes to complete setup then it only took a few seconds to install the tp-link plugin. I opened the Home app on my phone immediately and there was my garage light switch, already connected to everything else in my house. Holy shit.

I installed a few more plugins, one to get a web-frontend to the app, and another to control my garage doors. Plus, there are plugins for platforms and products that are stuck in the pissing matches between tech giants. There’s a plugin for every product Nest makes (but which Google refuses to natively connect to Apple’s IoT ecosystem).

It’s really incredible how a pile of javascript can basically create a fake Homekit hub for almost every product on earth, let you connect things and do more with them than ever before. I even installed plugins for my things that already work with Homekit, which gave me new capabilities and promptly fixed quite a few issues with IoT devices on my network. My wifi garage door now opens instantly when I press Open in Homekit where if I use the app made by the manufacturer itself, it can take up to 30 seconds to register the open command. So it’s not only more flexible but Homebridge is actually making my devices work better.

I wouldn’t be surprised if a future release of AppleTV just baked this app into a background service so Apple could offer Homekit support to nearly everything connected to the internet without having to wait for every IoT company to come on board.

If you use Homekit, definitely check out Homebridge on a raspberry pi. It’s remarkable what free software and a little cheap computer can do these days.