Let’s get these cheap switches talking to Siri shall we?
Apple’s HomeKit enjoys much lower compatibility with third party services than Amazon’s Alexa and Google’s Home. Whether that’s due to a greater desire for security on Apple’s part or a desire to implement direct control that will allow devices to be supported even after third party services shut down is just conjecture on my part. However, for those willing to tinker a bit, you can get HomeKit to speak to many more services than Apple natively allows. The key that unlocks this is Homebridge.
What is Homebridge?
Homebridge bills itself as “HomeKit support for the impatient.” It runs on multiple hardware platforms (yes, you’re going to need to implement some hardware) and acts as a bridge that connects HomeKit to the unsupported platforms. Plugins are used to support different third party integrations.
Why Homebridge for me?
In previous posts I’ve shown how to control lights using the eWeLink and Google Home apps on iOS however these don’t offer the native integration into iOS that I’d like to use. Being able to say “Hey Siri, turn on Table Lamp” to my Apple Watch would be lovely.
Pros and Cons
- The software is free – Uses Apache License 2.0
- You’ll need some hardware to run Homebridge.
- That hardware needs to run 24/7. If it goes down, so does the ability to control your devices via HomeKit.
- You’re adding another internet connected device to your network, secure yourself appropriately.
- The eWeLink plugin that I’m using requires you to give it a user name and password.
- The implementation is much more involved that just using eWeLink or Google Home apps.
Homebridge can run on a variety of hardware so you can test it on a device you have already. I’ll be re-purposing the Raspberry Pi Zero W I bought a few years ago to make my TV smart. It’s possibly the lowest power hardware that Homebridge supports.
Step 1 – Get Homebridge Running on Raspberry Pi
Since I’m not running anything else on this Raspberry Pi, I chose the easy method of flashing the Homebridge Raspberry Pi Image.
You can start by following the excellent guide provided by Homebridge. This will take you all the way to having Homebridge running on the Raspberry Pi. For reference, I used the Raspbian-Homebridge-v1.0.6.zip image. No comments from me on the process, all steps worked perfectly.
Once you reach Step 6, continue here for the setup of the eWeLink plugin.
Step 2 – Add eWeLink plugin to Homebridge
So now Homebridge should be up and running, connected to your iOS device and you’re ready to install the eWeLink Plugin.
Click Plugins on the top menu, search for ewelink and install the homebridge-ewelink-max plugin by howanghk. This seems to be the most stable and longest maintained plugin for eWeLink that is available.
After installing you will be presented with this screen:
But before putting in any details here, we need to create another eWeLink account to use just for Homebridge and share any relevant devices to that account. The reasoning and steps for this can be found here.
In version 0.1.24 of homebridge-ewelink-max (used in this guide) and perhaps previous and future versions, this settings panel only accepts phone numbers and passwords (and not email addresses and passwords as one would use in South Africa). So we’ll have to do some tweaking later on. For now, set Country Code to 1 and put in your newly created secondary email account in the Phone Number field. Fill in your Password and in the IMEI field you can use one generated here. When you’re done, close the “group” so it looks like this with all your details:
Then click SAVE and then Config on the Top Menu. Now we’ll make the tweaks to use the correct Country Code and Email parameter. Change your country code to 27 (for South Africa) and phoneNumber to email so it resembles the below and click SAVE:
(You can also find a sample config.json here)
Then click the Restart Icon on the top right.
When Homebridge completes it’s restart, If you go to Accessories you should see all your lights there (and you can click on them to test)!
And they should also be added to all your iOS device/s as well! (Seen below on Apple Home app on iPad:
From here on, you can move them to separate rooms and rename them as you wish. You can also change the devices to Display As Switch, Fan or Light depending on your setup.
When at home, I can now control all the lamps using the Apple Home app as well as Siri. My watch can now control the lights! It’s a bit slow on the Apple Watch Series 2 but it’s been quite reliable on the iPhone 8, X and iPad 6th gen that I also use.
My Smart Home Setup after this Implementation
Adding hardware running Homebridge has definitely made controlling the lights with my iOS (and watchOS and iPadOS) devices much simpler and native however not without some caveats:
- Doesn’t work when I’m away/not connected to the WiFi
- (Speculation) Still has to talk to eWeLink Cloud to control the devices.
To fix these will require more hardware to be purchased (Apple TV 4k or HomePod) and for the switches to be flashed so they will talk directly to Homebridge. I’m rapidly reaching the point where I have to make some decisions about how the smart home is architectured for compatibility with Android and iOS as well as running securely and locally. Will be taking you on this journey as well!
If you have any questions/would like to share your experience with Homebridge or architecting a smart home, please leave a reply below. Thanks for reading!
Controlling your home with your watch feels like the future!