Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

32828870

Suspended
Original poster
Jun 23, 2016
329
583
New York and Berlin
"Homebridge": The Missing Link for non-HomeKit Accessory Use

Lastly, if you're intermediate to advanced in tech or want to play around with light programming, 'Homebridge" is a project that has been in development for a while. "Homebridge" allows non-HomeKit accessories to work with iOS "HomeKit".

Homebridge is a lightweight NodeJS server you can run on your home network that emulates the iOS HomeKit API. It supports Plugins, which are community-contributed modules that provide a basic bridge from HomeKit to various 3rd-party APIs provided by manufacturers of "smart home" devices.

Since Siri supports devices added through HomeKit, this means that with Homebridge you can ask Siri to control devices that don't have any support for HomeKit at all.

"Homebridge" is based on "git"/"GitHub" and can be installed on a Windows, Linux, Raspberry Pi, OS X, etc system. If using a Mac, make sure it's a Mac that is always on and give it a static IP address (can be done in Apple's "Airport" app if using an Apple router or using the configuration settings depending on your wireless router). It's important as "Homebridge" will be "talking" to other systems, if your router designates differing IP's on your home network it will interfere with its functionality.

The "Homebridge" link is helpful yet confusing as OS X doesn't have the required backend installed. "MacPorts" has been a well known and used alternative yet some prefer "Homebrew". If you are unfamiliar with either and don't have the time or desire to learn a bit, this isn't for you. If you are interested, I highly recommend giving it a try.

I have a 2012 "Mac mini" I use for a Home Theatre system connected to four Synology servers for media (~1000 lossless movies) connected via my McIntosh system and LG OLED (and yes, it does carry lossless audio in TrueHD, ATMOS, etc with a bit of research and work, but that's another story). I've installed "Homebridge" on that "Mac mini" using "Homebrew" and followed these instructions in addition to the "Homebridge" site as the other guide was more in-depth while being very easy to follow.

NOTE: Disregard the section on buying an app as this guide was done just before iOS 10 released its "Home" app, thus no need to buy an app as it is already built into iOS.

The trick is deciding which backend to use: "MacPorts" or "Homebrew". I opted for "Homebrew" which required some quick research as the commands in the instructions are different. Once everything is installed and setup using "Homebrew", etc., here are some pointers:

1. Install Xcode. Download Xcode 8 from the Mac App Store for free, then open it and install terminal commands, etc.

2. Using "Terminal", if the homebridge command returns with the following error:

"root" does not have permission to access dev dir.... add the following to the installation command:

--unsafe-perm

Thus, install "Homebridge" via "Terminal" using the following command (copy and paste if you like):

sudo npm install -g --unsafe-perm homebridge

3. This is one error I could not resolve as I didn't have enough time:

clang: libstdc++ is deprecated, move to libc++ with a minimum deployment target of OS X 10.9

What this means is that OS X has moved from libstdc++ to libc++ a long time ago yet doesn't seem to indicate such. Simple solution is to point OS X to the new libc++ library

Using Homebridge:

1. Open "Terminal"
2. Type "homebridge" (without quotes, never use quotes in terminal unless specifically required which is why I didn't include any above) then enter
3. Homebridge will check for any inconsistencies such as those listed above and will recommend fixes
4. Homebridge will run and display a "HomeKit" code, name (Homebridge), running on port xxxxx, node xxxx, etc (those can be changed)
5. Open "Home" on an iOS device and select the "+" sign in the upper right corner
6. Select "Add Accessory"
7. "Homebridge" should appear, if not select "My Accessory Isn't Shown Here" and enter the HomeKit code from "Terminal"
8. Once "Homebridge" is added to "Home", it will show as an accessory.

At this point, "Homebridge" is working and running on your Mac as a lightweight NodeJS server that emulates "HomeKit" yet accessories need to be installed and configured.

Quit terminal and shut down homebridge (running homebridge again is as simple as entering homebridge in "Terminal"). Adding non-HomeKit accessories are done by downloading the "Plugin" (NodeJS module) for your device and installing it. Once you have your device plugin, which should look like "homebridge-nameofaccessory. Loading the plugin requires modifying a file named config.json that should be located in your hidden .homebridge folder in your /User/ folder (you'll need to unhide files and folders by typing the following in "Terminal":

defaults write com.apple.finder AppleShowAllFiles TRUE

killall Finder

Hidden folders and files will show in Finder, the icons will seem "dim".

A config-sample.json file can be downloaded here . Change the name to config.json and do not use a text editor or any other editing app other than Atom text editor. Download, open the DMG and drag the app to your Applications folder. Open "Atom" and use it to edit the config.json file in order to add accessories and platforms (plugins, etc) for your devices.

Plugins can be found here. Search for the plugin for your device, read the brief information from the developer. Plugins are installed the same way as "Homebridge" - as a global NPM module. Example:

In "Terminal", enter the following command followed by the name of your accessory plugin:

sudo npm install -g homebridge-accessoryname

If the same error occurs as before, add --unsafe-perm to the command:

sudo npm install -g --unsafe-perm homebridge-accessoryname

This is when basic coding is required as plugins are activated by modifying a file that homebridge loads, the config.json file.

Each plugin has different configuration settings that need to be added to the config.json file using "Atom". Instructions for each accessory plugin should be on the page for the npm accessory (some are as simple as copying and pasting the code then modifying it by adding credentials or other information to properly access and load the plugin and device). If you're a novice or haven't had much experience with basic editing, you can either wait for a HomeKit version of the device(s) or take some time with a little patience and give it a try. The instructions on the "Homebridge" site and the information for each plugin should help piece it together.

After modifying the config.json file, open "Terminal" and type homebridge. If all works, it will load with no errors. "Terminal" needs to be running in order for the homebridge to work. Open "Home" on an iOS 10 device and you should see "homebridge" as an accessory. The accessory should indicate it is running. If "No Response" is displayed then you may have homebridge running twice which happens. Open "Activity Monitor" and make sure "All Processes" are selected, then force quit any running instances of "homebridge" as sometimes if not properly terminated it will run homebridge twice.

Press and hold on the "homebridge" accessory then click on "Details" at the bottom. The usual settings will display - name, location, Include in Favorites. Select "Accessories". This will list the SmartHome devices installed and running via homebridge. From there you can see what is running, use the "Home" app to control the device in addition to "Siri", etc. It will act exactly like a HomeKit device.

Hope this helps!
 
  • Like
Reactions: Pow! and Feenician
nice one writing up a guide.

i have LIFX bulbs and tried this a couple of months ago on my macbook air. not a permanent solution as it's not always on, but served as interesting proof of concept.

as an aside, i found homekit lacking somewhat. lifx very easily let's you set various white tones, whereas homekit makes it quite hard to do that.
 
nice one writing up a guide.

i have LIFX bulbs and tried this a couple of months ago on my macbook air. not a permanent solution as it's not always on, but served as interesting proof of concept.

as an aside, i found homekit lacking somewhat. lifx very easily let's you set various white tones, whereas homekit makes it quite hard to do that.

It's improved greatly as more people, from novices to advanced users, have been playing with it and creating some great ideas outside and inside of HomeKit as this breaks the "chains" without risking security. I had been trying to run homebridge on my Mac mini for the past few months until just recently (had enough time, more progress, and iOS 10's "Home" app was the missing piece).

I posted a thread (walkthrough) on how to configure HomeKit devices using the "Home" app here. Check it out as initial setup isn't so much complicated but requires certain steps at certain stages be done with all devices logged out and wiped clean as setup is done on one iOS 10 device. Once done, other devices are added by either using the same iCloud account and making certain "Home" is on in iCloud Settings or inviting others (each invited individual can use devices, "Guest", or also edit settings, "Admin").
 
It's improved greatly as more people, from novices to advanced users, have been playing with it and creating some great ideas outside and inside of HomeKit as this breaks the "chains" without risking security. I had been trying to run homebridge on my Mac mini for the past few months until just recently (had enough time, more progress, and iOS 10's "Home" app was the missing piece).

I posted a thread (walkthrough) on how to configure HomeKit devices using the "Home" app here. Check it out as initial setup isn't so much complicated but requires certain steps at certain stages be done with all devices logged out and wiped clean as setup is done on one iOS 10 device. Once done, other devices are added by either using the same iCloud account and making certain "Home" is on in iCloud Settings or inviting others (each invited individual can use devices, "Guest", or also edit settings, "Admin").
to be clear i was testing it with ios 10's Home app (in beta). as well as a couple of third party apps that had tried to fill the hole that Apple's Home now fills. none of them allowed a simple white tone selection. might look into it again.

anyway, don't mean to distract from your guides, really nice you've done them
 
Thanks so much for this write up. It's just what I was looking for actually. I just dove into the world of HomeKit this weekend with the addition of some iDevices switches (with some Phillips Hue bulbs back ordered and on the way). Now that I'm using it I'm really seeing the value in having everything displayed in one app. So, I've been interested in setting it up so that I can see my Nest accessories (three Gen 2 Protects and a Nest cam) in the Home app too if possible. Again, it'd just be really nice if everything were visible at once.

However I also don't want to alter the functionality of my current devices too much, so I was wondering if someone could answer a fairly silly question of mine - if I set them up with Homebridge, would it mean that they're no longer visible in the Nest app, or that they wouldn't work if my always-on Mac mini (which I intend to use for Homebridge) was off for some reason? Sorry if I'm asking a redundant question - I'm fairly new to all this but am definitely very interested in learning more about how all this works.
 
However I also don't want to alter the functionality of my current devices too much, so I was wondering if someone could answer a fairly silly question of mine - if I set them up with Homebridge, would it mean that they're no longer visible in the Nest app, or that they wouldn't work if my always-on Mac mini (which I intend to use for Homebridge) was off for some reason? Sorry if I'm asking a redundant question - I'm fairly new to all this but am definitely very interested in learning more about how all this works.

Basically Homekit just adds another way of accessing everything on your device - you don't lose any access via other apps, OEM or otherwise. The nice thing about Homekit is that it aggregates everything and makes it simpler to use - ideal for most family members.
 
  • Like
Reactions: boston04and07
Hi, firstly thanks for your guide!
I am kinda stuck though, not sure if it is a complete newbie question, but here is my issue. I want to be able to control my Air Con (mini-splits) using HomeKit/Siri. I have an IR blaster (Cuby Smart) designed to do this (and working fine through its own app). I have installed HomeBridge (on my iMac, constantly on) and it is connected to my Home app etc. I have the http commands to send to the Cuby API, but i do not follow how to get from that to a HomeBridge PlugIn. I can see that Sensibo and Tado (AC IR blasters) have PlugIns, not sure if they can be "tweaked" to work.
Again sorry if this is a complete stupid question, i do feel like there is a simple answer, but I am not seeing / understanding it.

Cheers. MM.
 
Has anyone ever gotten Homebridge to work with Nest smoke detectors and cameras (not thermostats?) I've been trying to figure this out and am kind of stumped. Most of what I've found so far focuses on the thermostats and not the other Nest products. If anyone has I'd love to know what you did to get it to work.
 
Hello,

Im looking into getting a Nest thermostat, well Im buying one.

I know the Nest isn't HomeKit compatible and you have to use the Nest app straight out of the box but you can install HomeBridge on a Raspberry Pi or (in my case) have it running on a Mac server which I already have for VPN, Printer server, TimeMachine etc.

I have seen videos of people controlling the Nest via Siri but I as I don't use Siri at all I was wondering if you can use the iPhone/iPad Home app natively to control nest and not just use Siri?

Many thanks.
 
Hello,

Im looking into getting a Nest thermostat, well Im buying one.

I know the Nest isn't HomeKit compatible and you have to use the Nest app straight out of the box but you can install HomeBridge on a Raspberry Pi or (in my case) have it running on a Mac server which I already have for VPN, Printer server, TimeMachine etc.

I have seen videos of people controlling the Nest via Siri but I as I don't use Siri at all I was wondering if you can use the iPhone/iPad Home app natively to control nest and not just use Siri?

Many thanks.
Yes, install the Homebridge plugin that corresponds with Nest and you should be ok.
 
  • Like
Reactions: waring192
"Homebridge": The Missing Link for non-HomeKit Accessory Use

I just submitted to npm a plugin for Homebridge that allows you to play with Homebridge and not have any devices. In this way you can see what Homebridge and HomeKit are all about. The plugin is at: https://www.npmjs.com/package/homebridge-cmd4

Enjoy it if you like. I too wanted to see what HomeKit iwas all about.
 
This will probably be a massively stupid question, but I am completely new to Homebridge. I believe I have Homebridge installed using this procedure https://github.com/oznu/homebridge-syno-spk#how-to-install (Synology Package for Homebridge Docker) but the Home app does not find Homebridge. I suspect it has to do with port 51826, as I simply do not know where to open this port... I am a complete idiot about this; is it done on the home router, on the Synology, or where?

I try https://www.yougetsignal.com/tools/open-ports/ to test and it says the port is closed.

Any help is much appreciated!
 
This will probably be a massively stupid question, but I am completely new to Homebridge. I believe I have Homebridge installed using this procedure https://github.com/oznu/homebridge-syno-spk#how-to-install (Synology Package for Homebridge Docker) but the Home app does not find Homebridge. I suspect it has to do with port 51826, as I simply do not know where to open this port... I am a complete idiot about this; is it done on the home router, on the Synology, or where?

I try https://www.yougetsignal.com/tools/open-ports/ to test and it says the port is closed.

Any help is much appreciated!


You do that on your router. Just go into the port forwarding section and add which port you want to be the external facing one and which you want your internal to be. For simplicity you can use the same port number for both.

Click apply and you’re done.
 
You do that on your router. Just go into the port forwarding section and add which port you want to be the external facing one and which you want your internal to be. For simplicity you can use the same port number for both.

Click apply and you’re done.
thanks, TrueBlou, that is what I thought. I did try this, opening 51826 on the Zyxel home router. However, I fear I might not have input the right IP address this port should route to? I have a couple of ports open to the Synology already to allow external access to web hosting on the NAS and I used the same IP (the internal IP inside my home network). That did not work, the port is closed.
[doublepost=1518602187][/doublepost]
thanks, TrueBlou, that is what I thought. I did try this, opening 51826 on the Zyxel home router. However, I fear I might not have input the right IP address this port should route to? I have a couple of ports open to the Synology already to allow external access to web hosting on the NAS and I used the same IP (the internal IP inside my home network). That did not work, the port is closed.
Sorry, stupid me figured something more out: When I check port 51826 using the external IP of my home, portchecker sees it as open. It links to the IP address of the NAS so I was hoping that would take care of the port issue. Still, Home on my iPhone does not find the Homebridge when trying to add an accessory.
 
thanks, TrueBlou, that is what I thought. I did try this, opening 51826 on the Zyxel home router. However, I fear I might not have input the right IP address this port should route to? I have a couple of ports open to the Synology already to allow external access to web hosting on the NAS and I used the same IP (the internal IP inside my home network). That did not work, the port is closed.
[doublepost=1518602187][/doublepost]
Sorry, stupid me figured something more out: When I check port 51826 using the external IP of my home, portchecker sees it as open. It links to the IP address of the NAS so I was hoping that would take care of the port issue. Still, Home on my iPhone does not find the Homebridge when trying to add an accessory.

I had trouble with mine at the start too, once I had verified my ports were open here’s what I had to do. Albeit I’m using a pi, but I’d think the same should apply to most, particularly the changing of the MAC and Pin Code.

I changed the MAC address in Config.json and used a different Pin Code as HomeKit sometimes has trouble trying to add the same one again.

Then on my iPhone I reset HomeKit Privacy > HomeKit.

Finally on the Homebridge server, delete the /persist folder and all of the files inside it. You’ll find that under /homebridge/

Also make sure you have iCloud Drive and iCloud Keychain enabled on your iOS device.
 
  • Like
Reactions: BillGates1969
I had trouble with mine at the start too, once I had verified my ports were open here’s what I had to do. Albeit I’m using a pi, but I’d think the same should apply to most, particularly the changing of the MAC and Pin Code.

I changed the MAC address in Config.json and used a different Pin Code as HomeKit sometimes has trouble trying to add the same one again.

Then on my iPhone I reset HomeKit Privacy > HomeKit.

Finally on the Homebridge server, delete the /persist folder and all of the files inside it. You’ll find that under /homebridge/

Also make sure you have iCloud Drive and iCloud Keychain enabled on your iOS device.

Thanks again, several things here to try! Sorry to be so slow, but could I ask some clarifications:

- Changing the MAC address, what did you change it to?
- Resetting HomeKit Privacy, I hope that does not remove all the programming I have done of other devices?
 
Thanks again, several things here to try! Sorry to be so slow, but could I ask some clarifications:

- Changing the MAC address, what did you change it to?
- Resetting HomeKit Privacy, I hope that does not remove all the programming I have done of other devices?


The MAC address in Config.json can be anything you like, so long as it’s different to the one that was used previously. Same with the Pin.

I never lost anything with the Privacy > HomeKit reset. All you’re actually doing is toggling off anything that’s listed and turning it back on again. You can try without this step, I couldn’t say how essential it is, it’s just part of what I tried when I finally got it working.
 
The MAC address in Config.json can be anything you like, so long as it’s different to the one that was used previously. Same with the Pin.

I never lost anything with the Privacy > HomeKit reset. All you’re actually doing is toggling off anything that’s listed and turning it back on again. You can try without this step, I couldn’t say how essential it is, it’s just part of what I tried when I finally got it working.

Excellent, then I have a few things to try tonight. Sorry to be bothering you, but you really seem to know your way around this. The Config.json file, the default set up by Homebridge looks like shown below. When you say changing the MAC address, is it the username? Or where do I change the MAC address?

I also saw advice about changing the Host name to the actual name of my NAS. I tried this, but I don't really know the syntax of the json file, how should this be inserted into the config file (DS_HOSTNAME=SynologyDS713)?

{
"bridge": {
"name": "Homebridge",
"username": "CC:22:3D:E3:CE:30",
"port": 51826,
"pin": "031-45-154"

},

"description": "This is an example configuration file. You can use this as a template for creating your own configuration file containing devices you actually own.",

"accessories": [
],

"platforms": [
]
}
 
Excellent, then I have a few things to try tonight. Sorry to be bothering you, but you really seem to know your way around this. The Config.json file, the default set up by Homebridge looks like shown below. When you say changing the MAC address, is it the username? Or where do I change the MAC address?

I also saw advice about changing the Host name to the actual name of my NAS. I tried this, but I don't really know the syntax of the json file, how should this be inserted into the config file (DS_HOSTNAME=SynologyDS713)?

{
"bridge": {
"name": "Homebridge",
"username": "CC:22:3D:E3:CE:30",
"port": 51826,
"pin": "031-45-154"

},

"description": "This is an example configuration file. You can use this as a template for creating your own configuration file containing devices you actually own.",

"accessories": [
],

"platforms": [
]
}


I don’t mind if I can help I’m happy to.

Yes changing the MAC address is the username bit, sorry I should have said that.

When you’re running a Docker on a Synology then you’ll want to change the DS_HOSTNAME in the .env file to match that of your server name in Synology DSM Control Panel -> Info Centre -> Server name
 
Wouldn't have thought you need to open ports if you're on your internal IP range??

I setup Homebridge on a mac mini server a couple of weekends ago to add functionality for Hive Heating and Logitech Harmony.
It works fine, but occasionally will crash (every few days) and I've not figured out how to make it restart from Terminal (or get it to act as a "service").

I didn't know there was a Synology package, so might give that a go to see if it's more stable than the mac mini server homebridge.
 
Hi again, I have now tried most of the advice, but so far without success. What I have not managed to do is change the DSM_HOSTNAME as I cannot see a way to add that variable:

I have used the Synology Package for Homebridge Docker so I never touched those settings during setup and I cannot see a way to add variables to the container environment variables?
[doublepost=1518618140][/doublepost]Figured that one out, had to stop the contained first. Still no cigar, though - Homebridge simply doesn't show up...
 

Attachments

  • Screen Shot 2018-02-14 at 15.15.56.png
    Screen Shot 2018-02-14 at 15.15.56.png
    62.2 KB · Views: 410
Hi again, I have now tried most of the advice, but so far without success. What I have not managed to do is change the DSM_HOSTNAME as I cannot see a way to add that variable:

I have used the Synology Package for Homebridge Docker so I never touched those settings during setup and I cannot see a way to add variables to the container environment variables?
[doublepost=1518618140][/doublepost]Figured that one out, had to stop the contained first. Still no cigar, though - Homebridge simply doesn't show up...


One other thing that can cause big problems with Homebridge on Synology is the Synology Bonjure service.

If you’re using it, try shutting it off and see what happens with Homebridge.

I know this could be an issue if you actually use the Synology Bonjure service, but for the sake of debugging it’s worth trying.
 
Thanks, one more thing to try, but sadly with no positive effect... I am considering giving up...
[doublepost=1518619276][/doublepost]How close does my device need to be to the Synology, could this be an issue?
 
Thanks, one more thing to try, but sadly with no positive effect... I am considering giving up...
[doublepost=1518619276][/doublepost]How close does my device need to be to the Synology, could this be an issue?

Distance isn’t an issue you can do it from anywhere. Certainly seems to be odd that it’s not working.
Stupid question, but are you running DSM 6.0 or higher?
[doublepost=1518620366][/doublepost]Oh, and are you trying this setup with just an empty Homebridge setup, or with Plugins already added?

Sometimes it’s a plug-in that’s the cause, so it’s worth seeing if Homebridge works without plugins added.

Also make sure port 5353 isn’t blocked too.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.