How I used open source to extend Apple’s Home automation to more devices – ZDNet

How I used open source to extend Apple’s Home automation to more devices – ZDNet

I have to admit it: I backed the wrong horse when it came to driving home automation from a digital assistant and went with Microsoft’s Cortana and its Harmon Kardon Invoke smart speakers. 

Open Source

I had good enough reason: I trusted Microsoft’s privacy commitments a lot more than either Amazon’s or Google’s, and Apple’s Home relied on the too-expensive HomePod smart speakers. Sure, I had a couple of Amazon Echoes and a Google Nest Mini to try out those ecosystems, but their over-reliance on in-cloud voice recognition was that bit too much on the creepy side.

SEE: Hiring Kit: Python developer (TechRepublic Premium)

Still, I could happily control my Hue lights from Cortana, though support for my Netatmo thermostats and Ikea Tradfri lights had to be through maker tools like IFTTT and workflow automation with webhook APIs like Power Automate or Zapier. But then Microsoft refocused Cortana on its commercial customers and announced that its Invoke Cortana integrations were due to be turned off early in 2021. Would I have to rethink my privacy stance and switch to Alexa?

Luckily Apple’s HomePod Mini came along to save the day. Acting as a £99 hub for Apple’s HomeKit automation tools and using Apple’s own silicon to handle voice recognition locally, it promised to be the privacy-oriented home assistant that I’d be happy using. And it wasn’t going to be too expensive. What’s more, most of my existing home automation hardware was supported and could be controlled using Siri with device management from the Home app on my iOS devices.

Using Apple's Home app

Using Apple’s Home app to manage my office lighting.


Image: Simon Bisson

It didn’t take a lot of work to set up much of my home automation hardware with Apple’s Home. Most of the main consumer IoT vendors already support the HomeKit APIs, and Apple’s simple QR code-based enrolment scheme makes it easy to add devices to Home. You’re not limited to QR codes, as some devices like our Netatmo thermostat generate HomeKit codes and display them as numbers, with Netatmo’s e-ink display working very well. The Home app uses the iPhone camera with Home’s built-in OCR tool to quickly recognise codes and enrol hardware.

Within a few minutes of starting to move hardware to Home I had Hue and Ikea lights working, along with all our Netatmo thermostats (being in the UK with a hot water central heating system, I’d fitted smart thermostatic valves to most of our radiators), as well as a Sonos speaker via its Airplay connection, and an Arlo Pro camera and doorbell.

But those aren’t all the devices I have in my home. Many of the others have support for Alexa or Google Assistant, so it’s not that they don’t have APIs that can be used to either control them or get information from sensors. With device APIs and a public set of HomeKit APIs from Apple could there be a way to bridge that divide?

Homebridge.io

Homebbridge.io is an open source HomeKit extension that supports more devices than Apple, running on most home hardware.


Image: Simon Bisson

It turns out that there is, in the shape of the open source Homebridge project. At the heart of Apple’s HomeKit is the idea of the Bridge, a device that links hardware that doesn’t connect directly with HomeKit APIs, adding support for alternative APIs and protocols or working over non-IP wireless links like Zigbee. When you’re connecting Home to Hue lightbulbs, you’re not connecting to each and every bulb. Instead you’re working with a Hue Bridge that sits on your IP network and uses its own wireless links to control bulbs.

Homebridge acts the same way, connecting to Home via HomeKit bridge APIs and using a library of over 2,000 plugins to connect devices to Home. You may not get all the functionality of those devices (for example the best Sonos plugin just turns speakers on and off), but you do get much more control and the ability to add unsupported hardware into rooms and scenes, and even into HomeKIt automations.

SEE: Mac Mini (Late 2020) review: Apple’s most affordable M1 Mac offers great value for money

Installing Homebridge is easy enough, It’s supported on pretty much every platform you can think of, from Raspberry Pi to Windows 10 via Linux and MacOS, and can even be installed as a Docker container or on a NAS. I ended up using the Windows instructions to install it on my Windows Server 2019 NUC, as that’s on all the time as it provides DNS and DHCP for my network.

You do need some pre-requisites, as Homebridge installs as a node,js application via npm. So first sign as an administrator and download and set up the latest long-term support version of node. With that in place check that it and npm are available. Installing Homebridge is fairly straightforward: you need two npm packages, the server and its UI. Once that’s installed, use the built-in tools to set it up as a Windows service.

Homebridge is administered through either a set of JSON configuration files or using a web-based admin tool. I’d recommend using the admin tool, at least to get started, as it has a plugin search and support for either form or JSON-based configuration using a built-in editor. You can change the UI theme and add and remove widgets from the front screen.

Homebridge home screen

Homebridge’s home screen can be used to monitor your devices. 


Image: Simon Bisson

Once you’ve logged into the UI for the first time, use the QR code on the main portal page to add Homebridge to your Home set up, using the camera on an iOS device. With the bridge set up you can start to add plugins for any devices you want to control.

The plugin ecosystem is where Homebridge really excels. By having its own defined APIs, it’s possible for anyone with access to developer documentation to build a simple translation layer that links devices to HomeKit and to Home (and to Siri). Most of the plugins are on GitHub, so if you want additional features or support for alternative hardware, you can fork existing code and start to add your own features.

Searching for Homebridge plugins

Searching for Homebridge plugins.


Image: Simon Bisson

I’ve found plugins for our array of Sonos speakers and for the Govee LED light strips I’ve been using for backlighting around my desk. Sadly there aren’t any plugins for the older D-Link smart plugs I’ve been using to manage the Raspberry Pi that hosts my ADS-B server and its Twitter bot, but there is one for a newer version and I intend to fork its GitHub repository, track down documentation and build a version for my plugs. Of course, for that I need time.

The Govee LED lighting plugin is a good example of what can be done with Homebridge. It detects your hardware, uses a developer API key to connect (you can get one for yourself from a simple web form on the Govee site), and then exposes functions like colour and brightness, as well as power on and off. Once installed and set up, it’s accessible from Home on your phone.

Managing a Govee LED strip in Home

Managing a Govee LED strip in Home using a Homebridge plugin.


Image: Simon Bisson

Once plugins are installed and configured, devices show up in the iOS Home app and can be added to rooms and to scenes. They’re controllable via Siri, so you can use HomePod speakers to manage your rooms, with HomeKit and Homebridge devices equal citizens in your IoT environment. The resulting hybrid system works well, filling in the gaps between Apple’s home automation and its rivals at Google and Amazon. And as its open source, plugins update regularly and new ones are written to either add new features or support new devices.

If you’re worried about privacy and want voice-controlled IoT in your home, the combination of Siri, HomePod, HomeKit, and Homebridge is well worth investigating.

Published at Fri, 15 Jan 2021 08:00:00 +0000

Leave a Comment