Raspberry Pi HomeBridge the Easy Way + Web UI-X – HomeKit

Raspberry Pi HomeBridge the Easy Way + Web UI-X – HomeKit - Part-01

In this tutorial, we will see how to install and run Raspberry pi Homebridge the easy way and install and run HomeBridge web ui-x to manage all your devices and plugins.

Raspberry Pi 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.

HomeBridge web UI

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. For instance, using just some of the available plugins, you can say:

  • Siri, open the garage door.
  • Similarly, Siri, turn on/off Sony Tv.
  • Siri, turn on the living room lights.
  • Siri, good morning!
  1. In this video we will see how to install HomeBridge using NodeJS.
  2. Install and access HomeBridge Web UI-X
  3. change the port so you can run other services

You can start updating the OS by copying the commands below: ( it will prompt after the upgrade process start you have to type “Y” to continue)

sudo apt-get update sudo apt-get upgrade

copy both lines and paste it in terminal ( it will prompt to the 2nd command. Hit Enter to continue)

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - sudo apt-get install -y nodejs
sudo apt-get install libavahi-compat-libdnssd-dev
sudo npm install -g --unsafe-perm homebridge

Test Homebridge

Homebridge
sudo nano /etc/default/homebridge

paste this gist

# Defaults / Configuration options for homebridge # The following settings tells homebridge where to find the config.json file and where to persist the data (i.e. pairing and others)
HOMEBRIDGE_OPTS=-U /var/homebridge # If you uncomment the following line, homebridge will log more  # You can display this via systemd's journalctl: journalctl -f -u homebridge # DEBUG=*

and now create file homebridge.service

sudo nano /etc/systemd/system/homebridge.service

paste this gist

[Unit] Description=Node.js HomeKit Server  After=syslog.target network-online.target [Service] Type=simple User=homebridge EnvironmentFile=/etc/default/homebridge ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS Restart=on-failure RestartSec=10 KillMode=process [Install] WantedBy=multi-user.target

use the below commands one at a time:

sudo useradd --system homebridge sudo mkdir /var/homebridge sudo cp -r ~/.homebridge/persist /var/homebridge sudo chmod -R 0777 /var/homebridge sudo systemctl daemon-reload sudo systemctl enable homebridge sudo systemctl start homebridge

Now you are almost done, check the status of the service by typing:

systemctl status homebridge

And incase you need to see logs type:

 journalctl -f -u homebridge

You can manage HomeBridge from this web-interface.

start by installing  npm Raspberry Pi HomeBridge-config-ui-x using the below command:

sudo npm install -g --unsafe-perm homebridge-config-ui-x

Add the below script to your HomeBridge config.json file

"platforms": [    {       "platform": "config",      "name": "Config",       "port": 8080,      "sudo": false    }]

the above script is the default one to get you up and running. you still need to add plugins and add-ons for your devices based on what you need to do.

Click here to read about Raspberry Pi 4

Below I am sharing my own script that I added my Sony Tv and Denon AV receiver.

Also, you can explore all available plugins at the NPM website by searching for the keyword homebridge-plugin. Further, you can access the compatible ones from the UI tab under plugins.

My config script:

{
    "bridge": {
        "name": "Homebridge",
        "username": "CC:22:3D:E3:CE:30",
        "port": 51826,
        "pin": "031-75-159"
    },
    "ports": {
        "start": 52100,
        "end": 52150,
        "comment": "This section is used to control the range of ports that separate accessory"
    },
    "platforms": [
        {
            "platform": "DenonMarantzAVR",
            "name": "Denon LivingRoom",
            "host": "192.168.1.40",
            "maxVolume": 70,
            "secondZone": true
        },
        {
            "platform": "config",
            "name": "Config",
            "port": 8989,
            "theme": "red"
        }
    ],
    "accessories": [
        {
            "accessory": "Sony-Television",
            "name": "Sony Television",
            "ipaddress": "192.168.1.244",
            "presharedkey": "7777",
            "port": "80"
        }
    ]
}

Finally quick reboot will be good to make sure everything is working well.

sudo reboot now

Sources

Exit mobile version