I’m using a RaspberryPi 3 with RaspberryMatic distribution to control my HomeMatic thermostats. This distribution has a „heartbeat“ functionality, which leds the green LED of the Pi light up in constant time intervals.
These LEDs are quite strong and disturb the sleep of my family. Therefore its time to disable these leds.
Connect via SSH to the RaspberryMatic installation. Edit or create the file /usr/local/etc/rc.local and add this content:
echo none >/sys/class/leds/led0/trigger
echo none >/sys/class/leds/led1/trigger
Now make this script executeable:
chmod +x /usr/local/etc/rc.local
This script is executed on each start and disables the LEDs completely. No need to use some duct tape to mask the LEDs anymore 🙂
Inspired by tweets of Steven Troughten-Smith, people started to experiment with Raspberry Pi’s as DIY HomeBridge devices. One of them is Wojtek Pietrusiewicz. He wrote a nice article which I used as base for this post.
I own a Xiaomi Robot Vacuum. This robot can be controlled by the Xiaomi app, however, I don’t like it very much. The idea is to control this robot over HomeKit. To use HomeKit, I use an old Raspberry Pi 1B. The software will be HomeBridge.
Setting up the Pi
Installation and Configuration of Raspbian
Use Etcher to write the image to the SD card. Remount that SD card and add a file called „ssh“ in the root of the mounted partition. This will enable SSH from the beginning so that you can login directly to the Pi. I don’t want to attach a screen or keyboard to that machine so it will only be reachable over the network. Now boot your Pi from this SD card.
Identify the Pi’s IP (e.g. by looking at the network overview in your router). Now connect to that IP with user „pi“. The default password is „raspberry“. Please change the password now with
passwd and assign a new user password.
Update everything with apt:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get clean
Install nodejs 8.9.4
According to Wojtek only this version works currently with HomeBridge. I did not test any other version so I’m just describing what I did on my machine:
- Download nodejs for the PI into your users homefolder, e.g. with
- Unpack the file with
tar -xvf node-v8.9.4-linux-armv6l.tar.xz
sudo cp -R * /usr/local/
export PATH=$PATH:/usr/local/bin to e.g.
- node should be now available
- Install the necessary libraries:
sudo apt-get install libavahi-compat-libdnssd-dev
- Install HomeBridge with npm:
sudo npm install -g --unsafe-perm homebridge
/etc/default/homebridge and safe it with this content:
# 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)
# If you uncomment the following line, homebridge will log more
# You can display this via systemd's journalctl: journalctl -f -u homebridge
/etc/systemd/system/homebridge.service and safe it with this content:
Description=Node.js HomeKit Server
sudo useradd --system homebridge
sudo mkdir /var/homebridge
cp /usr/local/lib/node_modules/homebridge/config-sample.json ~/.homebridge/config.json
Setting up HomeBridge with Xiaomi Robot Vacuum
sudo npm install -g homebridge-xiaomi-mi-robot-vacuum miio
~/.homebridge/config.json and safe it with this content:
"description": "HomePi Homebridge.",
"name": "Vacuum Cleaner",
Generate a new MAC address separated by : using this website. You’ll need the IP address of your Xiaomi robot as well as the token. There are several ways to get the token. I’ve extracted mine from the iOS backup. Instead of uploading the token I’ve used this command on the token taken from the sqlite database:
echo '0: <YOUR HEXADECIMAL STRING>' | xxd -r -p | openssl enc -d -aes-128-ecb -nopad -nosalt -K 00000000000000000000000000000000
- Check if everything is working by starting homebridge for the first time. It should show a QR code. If it does, cancel the process with ctrl+c
Automate HomeBridge startup
cp ~/.homebridge/config.json /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
sudo systemctl status homebridge
Adding the HomeBridge to iOS devices
- Install the Home app, if you’ve removed it from your device. You can reinstall it from the App store.
- Open the Home app and add a new device
- If you’ve give the app access to your camera, you can scan the QR code you’ve seen earlier. However, HomeBridge is now running as a daemon in the background so you won’t see that QR code. You can add the bridge manually by using the PIN you’ve set in the config.
My current network setup allows me only to use small bandwidth connections between the living room (that’s where my Raspberry Pi is used as my Mediacenter) and office (my NAS). However, my Macbook is fast enough and can access the NAS wirelessly, so that I often use it as a replacement for the hardwired Raspberry Pi.
However, I cannot use my Hyperion Ambilight setup behind the TV in combination with the Macbook, because its only connected to the Raspberry Pi. But yesterday I’ve found this plugin which enables the Kodi setup on my Macbook to connect to the Hyperion Server on my Raspberry Pi over network.
- Download the zip file with the content of the git repository.
- Start Kodi on the Macbook and install it using the add on manager. You can point to the zip file directly without the need to unzip it first.
- Configure the installed plugin to connect to the ip of your Hyperion server.
- Start a video and be amazed that the lights on your TV will work wirelessly 😉