Back in June 2017, I started to make good use of my existing macOS equipment, and leveraging the Homebridge platform to integrate my existing non-Homekit devices into Apple’s HomeKit. At the time, this included:
- Belkin (Wemo power switches, Maker low voltage control device),
- D-Link (IP Cameras),
- LIFX (Lights), and
- Logitech Harmony Elite (Audio Visual)
Six months on, the range of HomeKit supporting accessories remains limited. Despite Apple announcing that HomeKit accessories could move from hardware to software authentication during its’ WWDC 2017 event, very few manufacturers have updated their current suite of devices with HomeKit support.
Despite Belkin announcing they’ll be releasing a HomeKit Bridge for their Wemo platform in May 2017, it still hasn’t materialised and has missed their stated launch window. Netgear’s Arlo platform remains absent, despite their users requesting it, and a vague reference in German from a company employee on an official forum suggesting it will be on at least one Arlo product in 2018 (just not the one everyone wants).
So, here’s all the things I’ve learned along the way up until now, that makes my home setup work as well as I can possibly make it.
Where am I at now?
My HomeKit and Homebridge environment is still going strong, with new devices added as well, including:
- Philips (Hue bulbs, and Motion Sensors)
This platform has native HomeKit support, and it plays nicely with the Non-HomeKit devices. - Sensibo Sky (Smart Air Conditioning controller)
- Sony Android TV
- Sonos Soundbar and related speakers/subwoofer
And whilst Apple’s HomeKit environment lacks some of the switches and commands to do more complex things (i.e. change to a TV channel, increase the volume, or switch to a specific input), I’ve been able to work around this using scenes with complex actions created using Elgato’s Eve app for iOS, which i’ve documented below.
At the moment however, the Logitech Harmony system has been moved out of the Homebridge environment due to issues downloading the package after a reinstall of the server. I have managed to compensate for this by turning the TV on and off using a specific scene, and leaving the Logitech remote set to the TV activity at all times.
Current environment
Initially, I installed Homebridge onto a 13″ 2016 Macbook Pro. However, I’ve recently elected to move the installation onto a Mac Mini running with macOS Server.
Current Homekit equipment environment consists of:
- Home hub
- Apple TV 4th Generation
- Lighting
- 4x LIFX Colour 1000 Lights
- 4x Philips Hue White Lights
- Power
- 2x Belkin Wemo Insight Switches (great for power consumption monitoring)
- 1x Belkin Wemo Switch
- Security
- Cameras supporting MJPEG or FFMPEG
- 2x D-Link IR Day/Night cameras
- 2x D-Link Day Cameras
- 3x Philips Hue Motion Sensors
- Cameras supporting MJPEG or FFMPEG
- Environmental
- Sensibo Sky Air Conditioning Controller
- Audio visual
- Sony 55″ X8500E 4K HDR Android TV with TRILUMINOS Display (KD-55X8500E)
- Sonos
- PLAYBAR,
- 2x PLAY:1, and
- SUB
- Logitech Harmony Hub
- Low Voltage sensors/controllers
- Garage Door: Belkin Wemo Maker
How did I do it?
Pre-requsites
If you’re reading this article, let’s presume you’re the type of person who already has a good home internet connection and wifi network, so I’ll skip over that part.
To do this successfully, you will need the following:
- A home computer or server that’s ‘always on’
(i.e. Windows, macOS, Linux, RaspberryPI, or even some NAS boxes) - An iOS device with Elgato Eve installed (reason for this will become apparent later)
- An Apple ID configured with both:
- Home hub
The features you want will determine your minimum hardware requirements for the device you use as a home hub:- If you want to control accessories remotely: Apple TV (3rd generation), or an Apple TV (4th generation) with tvOS 9.0 or later.
- Automations and user permissions: You need an Apple TV (4th generation) with tvOS 10, or an iPad with iOS 10 or later.
- Camera settings and URL’s
When it comes to the Non-HomeKit cameras you’re planning to connect, you need to know the camera resolution; and the URL’s for both audio, video, and image streams. More information on that is below, including a reminder to test your URL’s. - Patience
This will involve some trial, error, and some downloads. Don’t do this while tired, take your time, break it down into small pieces, and you’ll be amazed how well things work. This is especially true of when installing the Belkin Wemo Maker, as you’ll need to understand the device you’re connecting it to, what connections it offers, and have the manuals for it.
Camera settings
Next up, you need to get some information about your cameras.
First, find out the maximum image resolution for your camera. You should be able to get this from the settings page of its manual.
Second, you will need to get the URL for the video, audio, and image output of your camera. For D-Link cameras, and the others on this list, are well documented. Just find the name of your camera manufacturer, scroll down to the model number, and go from there.
Remember that if the URL shown in the database includes the camera’s username and password in the querystring, you put it there. For all others, you put the username and password in the URL, which is shown in my example config.json file below.
Finally, test your URL’s in your browser. You’ll save yourself a lot of time testing them first, just by copying the completed URL into your browser, to confirm they work. This ensures you don’t spend time doing complex debugging by reading log files or messing around with terminal commands, to figure out why they’re not working.
Homebridge Installation
- Follow this guide for installing Homebridge on macOS:
https://github.com/nfarina/homebridge/wiki/Install-Homebridge-on-macOS
(which has been heavily updated and revised after what i’ve learned) - Install Homebrew (only needed if intending to view cameras with the homebridge-camera-ffmpeg package)
https://brew.sh//usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- Install FFmpeg using Homebrew (Again, only needed if going to be using homebridge-camera-ffmpeg)
$ brew install ffmpeg
- Install the relevant packages for my devices:
$ sudo npm install homebridge-camera-ffmpeg $ sudo npm install homebridge-lifx-lan $ sudo npm install homebridge-platform-wemo $ sudo npm install homebridge-sensibo-sky $ sudo npm install homebridge-harmonyhub $ sudo npm install homebridge-bravia $ sudo npm install homebridge-zp $ sudo npm install homebridge-openweathermap
- Complete your config.json configuration file (see more below).
- Run Homebridge OR
IF you’re going to use the homebridge-bravia plugin, either read the Configuration section below to understand how to deal with this package, or spend a lot of time reading the readme file for this to get it properly running (https://github.com/normen/homebridge-bravia) - Follow the Apple Support article Use the Home app on your iPhone, iPad, and iPod touch (HT204893) to get the Home app setup, create your rooms, connect to Homebridge, and assign accessories to rooms, setup favourites etc.
- Follow the Apple Support article Automate and remotely access your HomeKit accessories (HT207057) so you can create automations, remotely control things away from home, and grant access to other people.
- Go and setup your scenes in Elgato Eve, so you can change TV channels, adjust volume, etc.
Configuration
The config.json file
When you go through the earlier installation steps, you’ll setup your config.json file.
If you’re new to JSON, I’d strongly suggest writing your config file in a text editor first, then testing it validates using JSONLint, before pasting it into your config file, saving, then starting up HomeKit.
I’ve obfuscated a few things in here obviously, the README file for Homebridge explains how to create your config.json file, and includes a sample file you can build on.
And remember – don’t use the default PIN in the sample config file. Leaving it as the default is going to make you look pretty silly when someone finds you’re running Homebridge, connects to your homes’ wifi network that you thought was properly locked down, and starts turning on and off all manner of switches (or turning on the TV audio at 3am in the morning with the last channel you had on – which will endear you to the neighbours).
{ "bridge": { "name": "Homebridge", "username": "XX:XX:XX:XX:XX:XX", "port": XXXX, "pin": "XXX-XX-XXX" }, "accessories": [ { "accessory": "Weather", "apikey": "Your API Key", "locationById": "Your Location ID", "name": "OpenWeatherMap Temperature" } ], "platforms": [ { "platform": "Server", "port": 8765, "name": "Homebridge Server", "log": "/Users/username/.homebridge/logfile.log", "restart": "launchctl unload ~/Library/LaunchAgents/com.homebridge.server.plist && launchctl load ~/Library/LaunchAgents/com.homebridge.server.plist" }, { "platform": "LifxLan", "name": "LiFx" }, { "platform": "HarmonyHub", "name": "Harmony Hub" }, { "platform": "SensiboSky", "name": "Sensibo", "apiKey": "Your API Key" }, { "platform": "BelkinWeMo", "name": "WeMo Platform", "noMotionTimer": 60, "ignoredDevices": [] }, { "platform": "BraviaPlatform", "tvs": [ { "name": "TV", "ip": "XXX.XXX.XXX.XXX", "cookiepath": "/Users/username/.homebridge/sonycookie", "tvsource": "tv:dvbt", "soundoutput": "speaker", "maxchannels": 200, "listapplications": 0, "apps": [ "com.sony.dtv.sonyselect-436bfc9b5bd4e592539a08096f1341bcc3ca9604", "com.sony.dtv.sonyselect-2e7fc758efc5f086a750ae20011633dbe25935cc", "com.sony.dtv.com.google.android.youtube.tv.com.google.android.apps.youtube.tv.cobalt.activity.ShellActivity", "com.sony.dtv.sonyselect-405f43aecbe92073ac3913eaa7500778e0cc8d3a", "com.sony.dtv.sonyselect-5a6a8ea601ee32ec482e251d176641048f96afbf", "com.sony.dtv.ceb-4834" ] } ] }, { "platform": "ZP", "service": "speaker", "brightness": true, "speakers": true }, { "platform": "Camera-ffmpeg", "cameras": [{ "name": "Cam 1", "videoConfig": { "source": "-re -f mjpeg -i http://username:password@10.0.0.1/mjpeg.cgi -i http://username:password@10.0.0.1/audio.cgi", "stillImageSource": "-f mjpeg -i http://username:password@10.0.0.1/mjpeg.cgi", "maxStreams": 2, "maxWidth": 640, "maxHeight": 480, "maxFPS": 30 } }, { "name": "Cam 2", "videoConfig": { "source": "-re -f mjpeg -i http://username:password@10.0.0.2/mjpeg.cgi -i http://username:password@10.0.0.2/audio.cgi", "stillImageSource": "-f mjpeg -i http://username:password@10.0.0.2/mjpeg.cgi", "maxStreams": 2, "maxWidth": 640, "maxHeight": 480, "maxFPS": 30 } }, { "name": "Cam 3", "videoConfig": { "source": "-re -f mjpeg -i http://username:password@10.0.0.3/mjpeg.cgi -i http://username:password@10.0.0.3/audio.cgi", "stillImageSource": "-f mjpeg -i http://username:password@10.0.0.3/mjpeg.cgi", "maxStreams": 2, "maxWidth": 640, "maxHeight": 480, "maxFPS": 30 } }] }]
The horrors of homebridge-bravia
This package alone could use its own article, as it was a little frustrating. This was, due in part, to less than solid documentation on the part of its developer.
The short version, there’s a few extra steps to get this package working nicely:
-
- If your TV gets an IP address via DHCP, it’s time to give your TV a static IP address. If your router supports the ability to assign an IP address based on the Mac address of the device, that’ll be the best path to go down.
- Configure Remote Start on your TV
On the TV, open Settings > Network, and enable Remote Start. - Once the package is installed, go to your Terminal application and follow these steps to prep the needed sonycookie file
cd ~/.homebridge touch sonycookie chown yourusername sonycookie chmod 777 sonycookie
- Make sure your TV is still powered on, and you can see it (as it will display a pairing key/PIN you’ll need to enter)
- From your Terminal app, run Homebridge
sudo homebridge
- Key in the pairing key/PIN displayed on the TV once home bridge asks for this in terminal
- Quit Homebridge, then restart.
- If you need to get the list of applications installed on your TV, open your Homebridge log file and look for the information displayed. Lines with the app details will normally begin with:
com.sony.dtv
And once you’ve done that, you’ll then need to have fun with some scenes to change channels.
Changing channels and volume
Now, HomeKit doesn’t understand voice commands for changing channels, or changing the volume.
These plugins will use a brightness switch, as a workaround for exposing a switch that will enable the action.
So, I mentioned the Elgato Eve app earlier – and this will come in handy.
Changing channels with scenes
The easiest way to change the channels is to create a custom scene for the specific channel.
Here’s a screen shot of the scenes i’ve created for this, and below is the instructions.

Scenes for some of the channels on my TV
To create your scene, do the following:
- Open the Elgato Eve app
- Navigate to the Scenes tab
- In the top-right corner, press the Edit button
- Press the Add Scene button that is now displayed.
- Follow the workflow to select your room (Living Room in my case), then set the switch for the relevant item (Living Room TV Channel in my case), and slide the slider until you get the channel number you want
- Press Add in the top-right corner of the window
- Press Next
- Give your scene a name (Change to Channel 31)
- Press Done
- Press Done again
From there, simply invoke the scene with Siri to change to the desired channel:
Change to Channel 31
It’s worth noting that I’ve found Siri often thinks “to” is “the” with my Australian accent, so I find I have to pause and add emphasis to the word “to” when calling this scene, to make it work consistently.
Setting custom Siri name for your TV speakers
First, make your life easier by setting some custom Siri names for your devices.
- Open the Elgato Eve app
- Navigate to the Rooms tab
- Select the room your Sonos speaker is in (Living Room in my case)
- Tap the Speaker instance for your Sonos speakers
- At the top of the speaker instance, tap on the disclosure triangle, then the configuration button
- Tap Siri Names
- Set a custom Siri name for your speakers
Changing the volume of your TV speakers
In my environment, the Sonos provides audio from my TV.
With the homebridge-zp plugin installed, and the custom Siri name set for the TV speakers as shown above – I can say the following to Siri to change the volume:
Change the TV speakers brightness to 50
And needless to say, the following would mute the volume:
Change the TV speakers brightness to 0
Create a scene for muting and unmuting the TV speakers
And for muting, and unmuting the TV audio – you can use the same method above for creating scenes – this time targeting the TV speakers brightness switch, which will handle this.
I’ve given these scenes simple names so they can be called quickly with Siri:
Mute the TV
Unmute the TV
Managing your Homebridge instance
If you want to remote into your server each time, to install, configure, and remove plugins – go right ahead.
However, if you’d like to make this is a little easier – there’s a couple of packages will make this a little easier using a web UI, depending on your individual needs.
These packages include:
Depending on the specific package, you can:
- Quickly access the HomeKit PIN graphic
- Search for, install or remove a plugin
- Configure a plugin
- View your log files
- Restart the Homebridge instance
Diagnosing problems
The quickest way to find any issues is to keep an eye on Homebridge’s logfile, using this command before you start Homebridge:
tail -f ~/.homebridge/logfile.log
From there, you’ll see the output of the logfile, and spot whatever is going on.
Additional things I learned along the way
- Read the readme files carefully
Whilst most of the NPM packages developed have solid documentation, not all of them are the best – especially for new users. So sometimes you need to take extra time to read them.
And if you need help, read the issue tracking pages for each plugin to see if there’s any useful information there. Worst case, you can ask for help in Reddit or via the project’s Slack channel. - Keeping your macOS unit always running
From time to time, it would take forever and a day to control accessories using the iOS Home app. This is because the mac had ‘gone to sleep’, and no matter the change to the Energy Saver preferences in System Preferences – it wouldn’t play nice. This was pretty easy to address with a simply terminal command:sudo systemsetup -setcomputersleep Never
- Cameras
As long as your camera has a stream in a supported format, you should be able to integrate that camera. for the camera-ffmpeg package, there’s a growing list of known good configurations you can work from for various cameras. The good thing is that D-Link’s cameras have used the same URI’s for their features for as long as I can remember – so the posted known good configuration for the DCS-932 will work for pretty much any D-Link consumer camera in circulation. - Garage Door
- Wires
Any good speaker wire will do the job nicely. Just make sure to not leave too much of the wire exposed outside of the terminal block on the Wemo Maker. 6mm of exposed wire will be more than enough. - Getting the connection terminals right
Luckily, the garage door at the place I live has various connection terminals on its controller board for wired control of both open/close, and sensors to indicate if the door was opened or closed. This meant no need to buy a magnetic reed switch and install it – saving extra time and work. A quick read of the manual, and looking at a good article from someone else who’d used the Wemo Maker for the same purpose, enabled me to figure out the wiring I needed to use, and got it done in one go (For the sensor, wiring COM on the door controller to – on the Wemo Maker, and NC to S).
- Wires
Things I still can’t do
- Cameras – Live view
The cameras will get an updated FFmpeg still in the Home app every 10 seconds. Would still like to try and get it working to a stream, but that requires more reading and understanding on my part. - Cameras – Alerts
There is at least one sensor package I’m yet to try, which uses the SMTP notification features of most cameras to provide alerts, or trigger actions when there are unexpected motions. I’m yet to sit down, understand which is the best package for my needs, and get going with it. Something to explore another time. - Power – Tracking usage stats
With the Belkin Wemo Insight switches, they make available their usage data which can be viewed in the logs for Homebridge. I would like to be able to get at this data, to track power consumption dynamically in a graph, and not looking in the Wemo app or looking at the spreadsheets it sends. - Philips Hue Motion and Sensibo Sky – Tracking temperature, humidity and lux settings
These devices output stats and information for various parameters, being temperature, humidity and lux. Again, like the Belkin Wemo, I’d like to be able to get this data out into some form of logging and live graphing for review purposes. - Harmony Elite
I’d like to get the Harmony Elite package working again. I’d also like to see if the package can only switch your configured activities on and off. It can’t change volume, pass other commands (stop, play, pause, input, show TV guides, etc). Not being a programming person, or having a deep understanding of the HomeKit platform, that’s something I’m not able to tackle. Maybe there’s a smarter cookie out there who just might be able to achieve it. - Xbox
I’m yet to play with a plugin someone has developed to do basic on/off control for this unit (which is really all that’s needed, given the Kinect gives the user the ability to voice control the device).
How much of this do you think could be achieved using a raspberry pi 3? I have a server running all the time but one of the plugins I saw was for WOL of any supported device, so I could tell Siri to turn on my server as required.
All of it can be done on a Raspberry PI. Only reason I did it with my Mac Mini is that’s what I had around.
Wow dude, what a fantastic post! Please keep me updated on how you go with getting live camera streams to work along with your other homekit adventures.
Thanks. And no idea why I didn’t see this reply earlier.