Homebridge is an easy way to use non-Homekit sensors or switches with Homekit. It breaks the gap and installs a bridge between your Homekit and a Raspberry Pi with some software. You don't need to know how to program, but it's good to know a little about how Linux and Bash work.

Part 1
Part 1 of 5:

Setting Up the Hardware

  1. 1
    Download the image link and copy it with Etcher to the microSD card.
  2. 2
    Insert the SD card into the Pi.
    Advertisement
  3. 3
    Connect the Raspberry Pi to a monitor.
  4. 4
    Power up the Raspberry Pi and login with:
    • Login: "Pi"
    • Password: "Raspberry"
    • Type:
      sudo raspi-config
      
  5. 5
    Change the following settings:
    • Under Locale, change your timezone and keyboard layout if necessary.
    • Under Network Options, set your wifi or LAN configurations.
    • Under Interfacing Options, set SSH to enabled.
  6. 6
    Apply changes by typing sudo reboot into the Terminal.
  7. 7
    Connect your laptop or PC to the Raspberry Pi. Make a SSH connection by typing the following into a Terminal:
      ssh pi@raspberrypi.local
      
  8. 8
    Update Raspbian and install Node.js. Paste the following into the Terminal or Bash:
      sudo apt-get update && 
      sudo apt-get upgrade && 
      sudo apt-get update && 
      sudo apt-get install -y nodejs && 
      sudo reboot
      
  9. 9
    Login to the Raspberry Pi again using SSH.
  10. Advertisement
Part 2
Part 2 of 5:

Installing and Configuring Homebridge on the Raspberry Pi

  1. 1
    Install all dependencies necessary for Homebridge by typing the following into the Terminal:
    sudo apt-get update && 
    curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash - && 
    sudo apt-get install -y nodejs && 
    sudo apt-get install gcc-4.9 g++-4.9 && 
    sudo apt-get update && 
    sudo reboot
    
  2. 2
    Install Homebridge using the following command:
    sudo apt-get install libavahi-compat-libdnssd-dev && 
    sudo npm install -g --unsafe-perm homebridge hap-nodejs node-gyp && 
    cd /usr/lib/node_modules/homebridge/ && 
    sudo npm install --unsafe-perm bignum && 
    cd /usr/lib/node_modules/hap-nodejs/node_modules/mdns && 
    sudo node-gyp BUILDTYPE=Release rebuild && 
    mkdir ~/.homebridge && 
    nano ~/.homebridge/config.json
    
  3. 3
    Copy and paste the Homebridge configuration from this source into the above window.
  4. 4
    Press Ctrl+X.
  5. 5
    Save changes using Y.
  6. 6
    Open the environment file for homebridge using:
    sudo nano /etc/default/homebridge
    
  7. 7
    Enable autostart by pasting this source file into the Terminal.
  8. 8
    Save your changes with the following keystrokes: Ctrl+X then Y.
  9. 9
    Find the homebridge path by typing:
    which homebridge
    
    • Be sure to write this path down!
  10. Advertisement
Part 3
Part 3 of 5:

Configuring Your Path and Credentials to Autostart Homebridge

  1. 1
    Open the systemd service file for Homebridge by typing:
    sudo nano /etc/systemd/system/homebridge.service
    
  2. 2
  3. 3
    Change the command that appears afterExecStart= to the line that was printed with the command which homebridge.
  4. 4
    Change user=homebridge to user=pi.
  5. 5
    Test your Homebridge configuration by typing homebridge into the Terminal.
    • If you see a QR Code similar to the one in the image below, your installation works!
  6. 6
    Terminate Homebridge with Ctrl+X.
  7. 7
    Activate autostart by typing the following into the Terminal:
    sudo mkdir /var/lib/homebridge && 
    sudo cp ~/.homebridge/config.json /var/lib/homebridge/ && 
    sudo cp -r ~/.homebridge/persist /var/lib/homebridge && 
    sudo chmod -R 0777 /var/lib/homebridge && 
    sudo passwd root && 
    systemctl daemon-reload && 
    systemctl enable homebridge && 
    systemctl start homebridge && 
    sudo systemctl -l status homebridge
    
  8. Advertisement
Part 4
Part 4 of 5:

Configuring Your iOS Device

  1. 1
    Open the Home app on your iOS device.
  2. 2
    Press the + sign to add a device.
  3. 3
    In the menu that pops up, tap "Add Accessory".
  4. 4
    Tap on "Don't Have a Code or Can't Scan?".
  5. 5
    Under "Manual Code", tap "Enter Code".
  6. 6
    Enter "031-45-154". This is the default code.
  7. Advertisement
Part 5
Part 5 of 5:

Adding Accessories and Platforms

  1. 1
    Install any connector from this npm package list to add an IoT device.
  2. 2
    Install the connector with:
       sudo npm i homebridge-{packagename}
      
    • This is a sample for netatmo devices:
       npm install -g homebridge-netatmo
      
  3. 3
    Configure the connector with:
     sudo nano /var/lib/homebridge/config.json
    
    • Be sure to read the help of the npm site/connector for configurations as they are different for every device.
  4. 4
    Apply configuration changes by restarting the Raspberry Pi:
     
    systemctl daemon-reload && 
    systemctl start homebridge && 
    sudo systemctl -l status homebridge
    
  5. Advertisement

Warnings

Advertisement

Things You'll Need

  • USB Keyboard
  • Micro SD Card
  • HDMI Cable
  • Monitor
  • Raspberry Pi 3 B

About This Article

wikiHow is a “wiki,” similar to Wikipedia, which means that many of our articles are co-written by multiple authors. To create this article, 31 people, some anonymous, worked to edit and improve it over time. This article has been viewed 19,038 times.
How helpful is this?
Co-authors: 31
Updated: June 29, 2021
Views: 19,038
Advertisement