A number of manufacturers of interesting kit have chosen to stay out of the smart home universe among them Ubiquity. Others like Nest play only in their own proprietary environment. HomeBridge is an open source software project that creates an environment in which Apple HomeKit bridges may be built. Smart home enthusiasts have developed over 2000 product plugins supporting popular devices.
Here at Dismal Manor we have two bridges, a Starling for Nest gadgets and Home Bridge on a RaspberryPi 4b that brings in the UniFi Protect camera RTSP streams.
The Starling is a commercialization of the Nest HomeBridge plugins. This product makes sense with the Thermostat and the cameras. It is less useful with just Protects.
In this article, I’ll describe my experiences setting up a UniFi Protect gateway and making the Ubiquity UniFi Protect cameras visible in HomeKit. UniFi Protect is one of the few camera systems having a Verified HomeBridge plugin.
- https://homebridge.io/ is the place to start for downloads
- https://github.com/homebridge/homebridge/wiki for the user guide
- https://github.com/homebridge/homebridge/wiki/verified-Plugins explains what a verified plugin offers.
CCTV At Dismal Manor
Here at the Manor, we have two CCTV systems, a UniFi Protect system that is primarily used to record arrivals and incidents at the fence. I installed the UniFi Protect cameras following a hit and run which murdered several thousand dollars of fence. I installed the EuFy cameras when HomeKit Secure Video became available for them. I use these primarily to watch for the dogs at the door but they also record arrivals at the back door and the garden gate.
The two systems have been independent for the longest time. To see the dogs at the porch I have to use Home App. To see the dogs behind the house, I have to switch to UniFi Protect app. What if we could see the UniFi cameras in Home App? Well we can and they look good. Well, the lenses need cleaning and things are looking faded after 4 years in service.
So I searched on HomeBridge plugins and, sure enough, there is one for UniFi Protect and it is pretty complete.
To begin the HomeBridge I ran down the software at HomeBridge.io, rummaged through the Pi bits and determined what I needed to build a Raspberry Pi 4b for HomeBridge, and ordered the missing bits from PiShop. These good folks in Deleware are authorized US distributors and offer quick service from stock. If I order on a Wednesday, my order is here on Saturday except during the holiday mail crush.
I also created a limited admin user authorized to view Protect cameras in UniFi. Be sure to give the user Local Credentials (a local user name and a local password). I made up a Gmail address for the account like Simpsons+HomeBridge@gmail.com to use as the required Email address. I accepted the invite from Gmail.
Assembling the Pi
The RaspberryPi 4b snaps into its case. I used BalenaEtcher App to transfer the HomeBridge zip file onto a microSD card. I used a 32 GB SanDisk of the video rated kind. I installed the video card, cabled up to the Study Rack switch (UniFi Switch-8-50), started the Pi, and browsed to homebridge.local. The official procedure is at https://github.com/homebridge/homebridge-raspbian-image/wiki/Getting-Started
Starting and Adding HomeBridge to HomeKit
The procedure for setting up HomeBridge and adding it to HomeKit is at https://github.com/homebridge/homebridge-raspbian-image/wiki/Getting-Started. Browse to your local HomeKit on port 80. Use the QR code shown to add your HomeBridge to HomeKit using the add home accessory procedure.
Install the UniFi Protect Plugin
Browse to the PlugIns page and search for the UniFi Protect plugin. The search results will look like the image below. When searching for available plugins, it is best to search for the specific brand name such as Arlo, Nest, EcoBee, SimpliSafe, UniFi etc.
As you can see, I picked the HomeBridge UniFi Protect plugin. It had the capabilities I wanted and it was “Verified” meaning it had received some level of peer review that found it sufficiently polished and complete for general use. I recommend use of verified plugins unless you’re up for some adventure.
Once the plugin is installed, open the Settings view and configure the plugin. If you have not already done so, add a UniFiOS Limited Admin user authorized with Read Access for Protect app. Create the user. UniFiOS will send a mail message to which you’ll reply to accept the invite so you’ll need a live email address, not a dummy. Gmail folk can do the + trick. Apple folk can do the forward trick.
The HomeBridge image needs the FFMPEG library added. Do that in the terminal which you can conjure up in the browser as shown below.
Once the terminal is open use apt to install the package.
I’ve already installed it in this machine. Apt will tell you what it intends to do and ask permission. Let it do the installation. When prompted, restart the HomeBridge host using the power button shown in the figure.
UniFi Protect Changes
Once you have finished with HomeBridge, move to UniFi Protect to set up the cameras to allow RTSP forwarding.
Pick the camera, open its settings, open the RTSP panel, and enable one of the RTSP streams. Do this for each camera you wish to appear in HomeKit.
Return to HomeKit app and track down the cameras. They will likely appear in the default room. Change their location to the one you prefer. Ours are in the Garden. Create a room if you need to.
The UniFi protect cameras won’t count against your 5 as the plugin does not integrate them with HomeKit Secure Video. The plugin supports real time viewing. For clips, you’ll need to visit Protect, find them, and export them.