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

Vado

macrumors regular
Original poster
Dec 30, 2016
138
154
Livingston, United Kingdom
I'm looking for some help (more like a good easy guide! - I'm new to linux) for setting up and configuring HomeBridge on a Raspberry Pi 3 along with Nest hardware.

I have several HomeKit devices already but want bring my Nest Thermostat and 2x Nest Protects into the Home app.

Is it also possible once the Pi is configured to make Homebridge automatically run on boot?

Thanks in advance :)
 

Vado

macrumors regular
Original poster
Dec 30, 2016
138
154
Livingston, United Kingdom
  • Like
Reactions: Bazooka-joe

rworne

macrumors 6502a
Jul 23, 2002
653
124
Los Angeles
Thanks for the reply. How reliable is this method?

I've seen other guides out there but some seem to contradict each other in certain ways. Does anyone have a good guide for setting up Homebridge on a Raspberry Pi remotely using Terminal?

Not really. There are quite a few of us here with working setups and can answer questions.

Basically the minimum you need for a hideable, low power, and cheap solution is:
Raspberry Pi Zero W
A case for the Pi Zero
AC to microUSB adapter
microSD card
optional, but recommended: mini-HDMI to HDMI cable, microUSB hub

Everything here should cost less than $30 or so.

Put on a bog-standard Raspian install on it. Turn on SSH.
Then install HomeBridge and get it to connect to your Homekit setup as a bridge.

Some online instructions have you set up a user account for homebridge. That is what you want to do, so if the Ri restarts for any reason, you do not need to restart homebridge by hand.

What comes next depends on what you want to connect to it.

When you get it working, pop out the microSD card and back it up. You'll thank me later.

One nice thing to add right away is homebridge-config-ui-x. I wish I had heard about this one earlier.

Nest products are a real pain to get running - lots of experimentation. Once you get it talking, it works great.
 
  • Like
Reactions: BillGates1969

Vado

macrumors regular
Original poster
Dec 30, 2016
138
154
Livingston, United Kingdom
Not really. There are quite a few of us here with working setups and can answer questions.

Basically the minimum you need for a hideable, low power, and cheap solution is:
Raspberry Pi Zero W
A case for the Pi Zero
AC to microUSB adapter
microSD card
optional, but recommended: mini-HDMI to HDMI cable, microUSB hub

Everything here should cost less than $30 or so.

Put on a bog-standard Raspian install on it. Turn on SSH.
Then install HomeBridge and get it to connect to your Homekit setup as a bridge.

Some online instructions have you set up a user account for homebridge. That is what you want to do, so if the Ri restarts for any reason, you do not need to restart homebridge by hand.

What comes next depends on what you want to connect to it.

When you get it working, pop out the microSD card and back it up. You'll thank me later.

One nice thing to add right away is homebridge-config-ui-x. I wish I had heard about this one earlier.

Nest products are a real pain to get running - lots of experimentation. Once you get it talking, it works great.

Thanks for the advice.

I've already ordered a Raspberry Pi 3 starter kit on Amazon (Pi 3, Case, Power Cable and SD Card).

Thanks for the quick points is there a particular set of instructions you'd recommend then? The only devices I'm looking at connecting to Homebridge are my Nest products.
 

Weaselboy

Moderator
Staff member
Jan 23, 2005
34,136
15,597
California
Thanks for the quick points is there a particular set of instructions you'd recommend then?

Here is a PM I sent a forum member recently on this topic. Might help you out.

I assume you will do this on a Mac. Attach the SD card and format to FAT32/MBR. Then download Raspbian strech lite from here.

https://www.raspberrypi.org/downloads/raspbian/

Then use Etcher to burn the Raspbian image to the SD card.

https://www.raspberrypi.org/documentation/installation/installing-images/README.md

Then so you can SSH into the Pi, you need to make a blank text file called ssh. You can use Nano in Terminal to do that. Once you make the text file, drop it into the root of the SD card. Then when the Pi boots it will have SSH enabled and you can login to it.

If you are using the Pi over ethernet, you are now ready to run. Just insert the SD card in the Pi, connect to power and ethernet and wait for it to start.

If you plan to use wifi, there are instructions here before you dismount the SD card from the Mac.

https://medium.com/@jay_proulx/headless-raspberry-pi-zero-w-setup-with-ssh-and-wi-fi-8ddd8c4d2742

Then you can login to the Pi in Mac or iOS Terminal apps by entering "ssh pi@10.0.1.27" (using your Pi's IP). The default password is raspberry.

Then do sudo raspi-config and change the password and set your country and time options.

Then I would run these two commands to update the Pi OS.

sudo apt-get update

sudo apt-get dist-upgrade

Then sudo reboot afterwards and SSH back in.

Then follow this to setup Homebridge.

https://github.com/nfarina/homebridge/wiki/Running-HomeBridge-on-a-Raspberry-Pi
 

rworne

macrumors 6502a
Jul 23, 2002
653
124
Los Angeles
Thanks for the advice.

I've already ordered a Raspberry Pi 3 starter kit on Amazon (Pi 3, Case, Power Cable and SD Card).

Thanks for the quick points is there a particular set of instructions you'd recommend then? The only devices I'm looking at connecting to Homebridge are my Nest products.

I followed these instructions. It works for any PI model.
https://brandonb.ca/raspberry-pi-zero-w-headless-setup-on-macos - general setup
https://brandonb.ca/getting-started-with-homebridge-on-a-raspberry-pi-zero-w-with-homekit - homebridge setup

The second link is missing once crucial piece of information - its mentioned a homebridge user, but never explained how to set it up. Info for that is here:

https://gist.github.com/johannrichard/0ad0de1feb6adb9eb61a/

Getting Nest working requires getting a Nest dev account:

https://www.npmjs.com/package/homebridge-nest

The trick is - getting it to work with the new API.
Once you get to the steps 12-15, it's very important to be careful. The token that they mention is quite long, and you will need to widen the terminal screen when reading the log to get all of it. If you leave it at the normal 80x25 size, it will truncate the token and have you wondering why it won't work.

In the end, it works great:
 

Attachments

  • IMG_1292.PNG
    IMG_1292.PNG
    736.9 KB · Views: 511

Vado

macrumors regular
Original poster
Dec 30, 2016
138
154
Livingston, United Kingdom
Here is a PM I sent a forum member recently on this topic. Might help you out.

I followed these instructions. It works for any PI model.
https://brandonb.ca/raspberry-pi-zero-w-headless-setup-on-macos - general setup
https://brandonb.ca/getting-started-with-homebridge-on-a-raspberry-pi-zero-w-with-homekit - homebridge setup

The second link is missing once crucial piece of information - its mentioned a homebridge user, but never explained how to set it up. Info for that is here:

https://gist.github.com/johannrichard/0ad0de1feb6adb9eb61a/

Getting Nest working requires getting a Nest dev account:

https://www.npmjs.com/package/homebridge-nest

The trick is - getting it to work with the new API.
Once you get to the steps 12-15, it's very important to be careful. The token that they mention is quite long, and you will need to widen the terminal screen when reading the log to get all of it. If you leave it at the normal 80x25 size, it will truncate the token and have you wondering why it won't work.

In the end, it works great:

Thank you both for the info. I'm going to get my Raspberry Pi over the next few days, will hopefully get some time to set it up....no doubt I'll be back for help when I inevitably mess it up the setup and HomeBridge config!:D
 
  • Like
Reactions: Weaselboy

rworne

macrumors 6502a
Jul 23, 2002
653
124
Los Angeles
Thank you both for the info. I'm going to get my Raspberry Pi over the next few days, will hopefully get some time to set it up....no doubt I'll be back for help when I inevitably mess it up the setup and HomeBridge config!:D

No problem.

If you set it up based upon the links I posted, I have config files I can post. If you search this forum with my username, you'll see some of them I posted earlier.
 
  • Like
Reactions: Vado

Vado

macrumors regular
Original poster
Dec 30, 2016
138
154
Livingston, United Kingdom
I've got my Homebridge up and running on my Raspberry Pi 3 along with my Nest devices :D

Can some give me simple instructions on how to get Homebridge to automatically start on boot/reboot of the Pi?
 

Vado

macrumors regular
Original poster
Dec 30, 2016
138
154
Livingston, United Kingdom
Last edited:

BillGates1969

macrumors 68000
Sep 11, 2008
1,719
3,457
Poole, UK
Thanks for posting this. I'm a complete newbie when it comes to this.....i'm not 100% confident with these instructions.

Also anyone able to give me an idea of the best way to backup my working Homebridge setup and configuration (Already got the config.json backup)

I've reinstalled HomeBridge a couple of times (One SD card failure and second time I put a fresh install of the Raspbian Stretch OS) and all I do is keep a copy of the config.json and every plugin I install I write the name to a text file and save that.

If you need to re-install, just install HomeBridge as normal and then install all the plugins one by one. Drop in your config.json and you are good to go.

You can also remove your SD card and back it up as a disk image to your Mac.

I work normally entirely on the command line, but another poster on here (sorry forgotten your name :( Edit - thank you @Weaselboy ), showed a plugin that is installed as normal and gives a nice GUI on a web front end to configure. I use that all the time now.

https://github.com/oznu/homebridge-config-ui-x

You can also backup the config.json through there rather than needing to do it via command line. If you haven't already, install a samba server on the Pi so you can share folders and use your Mac/PC gui to navigate to it:

https://www.raspberrypi.org/magpi/samba-file-server/

I use this guide to do it. I share my homebridge directory.


EDIT: I feel your pain on the confidence to do stuff in Linux. For the last 15 years or so I have been a Infrastructure Specialist, mainly using Windows and Citrix, but over the last year or so I have embraced the command line and now get involved with Linux projects at work :) It is easier than it looks :)
 
Last edited:
  • Like
Reactions: Weaselboy

Vado

macrumors regular
Original poster
Dec 30, 2016
138
154
Livingston, United Kingdom
I've reinstalled HomeBridge a couple of times (One SD card failure and second time I put a fresh install of the Raspbian Stretch OS) and all I do is keep a copy of the config.json and every plugin I install I write the name to a text file and save that.

If you need to re-install, just install HomeBridge as normal and then install all the plugins one by one. Drop in your config.json and you are good to go.

You can also remove your SD card and back it up as a disk image to your Mac.

I work normally entirely on the command line, but another poster on here (sorry forgotten your name :( Edit - thank you @Weaselboy ), showed a plugin that is installed as normal and gives a nice GUI on a web front end to configure. I use that all the time now.

https://github.com/oznu/homebridge-config-ui-x

You can also backup the config.json through there rather than needing to do it via command line. If you haven't already, install a samba server on the Pi so you can share folders and use your Mac/PC gui to navigate to it:

https://www.raspberrypi.org/magpi/samba-file-server/

I use this guide to do it. I share my homebridge directory.


EDIT: I feel your pain on the confidence to do stuff in Linux. For the last 15 years or so I have been a Infrastructure Specialist, mainly using Windows and Citrix, but over the last year or so I have embraced the command line and now get involved with Linux projects at work :) It is easier than it looks :)

Thanks for that. Will look into that GUI frontend.

Regarding the guide you posted for getting HomeBridge to auto start. I have a few questions.....

Is it just acas of copying and pasting the whole 'gist' file as written in Step 1 and 2 in the files you are creating with Nano?

Is there a way I can check how my HomeBridge has been installed prior to starting, to avoid any issues like in Step 2?
 

BillGates1969

macrumors 68000
Sep 11, 2008
1,719
3,457
Poole, UK
Yes that is all you do. Copy it and paste into a nano window.

Look at the path in step 2 to see if it exists, just do a:

cd /usr/local/bin/ and see if HomeBridge directory exists. If not remove the local bit to see if that exists.

From memory mine was as he gist.
 
Last edited:

Vado

macrumors regular
Original poster
Dec 30, 2016
138
154
Livingston, United Kingdom
Yes that is all you do. Copy it and paste into a nano window.

Look at the path in step 2 to see if it exists, just do a:

cd /usr/local/bin/ and see if HomeBridge directory exists. If not remove the local bit to see if that exists.

From memory mine was as he gist.

Ok I followed the instructions but when I check the status of service at the end, I get this result. Anyone able to help?:

[pi@raspberrypi:~ $ systemctl status homebridge

● homebridge.service - Node.js HomeKit Server

Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor preset: enabled)

Active: activating (auto-restart) (Result: exit-code) since Thu 2018-05-03 17:49:23 BST; 8s ago

Process: 592 ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=203/EXEC)

Main PID: 592 (code=exited, status=203/EXEC)


May 03 17:49:23 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.

May 03 17:49:23 raspberrypi systemd[1]: homebridge.service: Failed with result 'exit-code'.
 
Last edited:

Vado

macrumors regular
Original poster
Dec 30, 2016
138
154
Livingston, United Kingdom
Ok I followed the instructions but when I check the status of service at the end, I get this result. Anyone able to help?:

[pi@raspberrypi:~ $ systemctl status homebridge

● homebridge.service - Node.js HomeKit Server

Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor preset: enabled)

Active: activating (auto-restart) (Result: exit-code) since Thu 2018-05-03 17:49:23 BST; 8s ago

Process: 592 ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=203/EXEC)

Main PID: 592 (code=exited, status=203/EXEC)


May 03 17:49:23 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.

May 03 17:49:23 raspberrypi systemd[1]: homebridge.service: Failed with result 'exit-code'.

Solved it myself! Turned out my Homebridge install wasn't right location in Step 2. I had to remove 'local' from the line
ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS in the gist and BINGO! The service started first time after following Steps 8-10 :D

When I was creating my own Nest api on the Nest developers site. I added support for the Nest Cam, if I wanted to add a few to my setup how would that with Homebridge, I'm guessing it would be display only in the Home app with any recording being done through the Nest app?

If I did add a Nest Cam would it just be a case of restarting Homebridge for it to fetch the Nest Cam on my account?
 
Last edited:
  • Like
Reactions: BillGates1969

scouser75

macrumors 68030
Oct 7, 2008
2,702
539
Brilliant. Will order tonight.

Also, I done a quick bit of research on how to get my Ring Doorbell 2 to work on Homekit using Terminal but didn't find anything. Does anyone on here know if it's possible? I don't have access to a PC so Terminal is my only option.
 

scouser75

macrumors 68030
Oct 7, 2008
2,702
539
Thanks Weaselboy. I'm absolutely new to all this, so please forgive the questions, but do I use Macs Terminal app to carry all this out?
 

scouser75

macrumors 68030
Oct 7, 2008
2,702
539
  • Like
Reactions: Weaselboy
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.