Monthly Archives: December 2019
It looks like today is one of the few days of the year where YYYY
doesn’t produce the same result as yyyy
. 🤦♂️.
Installing Homebridge and homebridge-camera-rpi on a Raspberry Pi Zero W
I finally started over from scratch with my Raspberry Pi Zero W and Camera Module V2. These are the steps I took to configure it with Homebridge as a Homekit-compatible camera.
Initial Pi Setup
- Using balenaEtcher, I installed the September 2019 version of Raspbian Buster Lite (link to latest release) on my SD card.
- I enabled
ssh
access by creating an empty file namedssh
at the root of the SD card. To allow the Pi onto my home network, I created a file named
wpa_supplicant.conf
at the root of the SD card. The contents should be:country=US ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev network={ ssid="YOUR_NETWORK_NAME" psk="YOUR_PASSWORD" key_mgmt=WPA-PSK }
Then I inserted the SD card in the Pi, booted it up, found it’s IP address on my network (I used LanScan), and connected via
ssh pi@<ipaddress>
.- It’s important to change the
pi
account password with thepasswd
command. - I selected my time zone and set the locale to
en_us.UTF-8
viasudo raspi-config
. Finally, I updated the software with:
sudo apt-get update sudo apt-get upgrade
Install Homebridge, homebridge-pi, and homebridge-camera-rpi
Homebridge requires an installation of node.js, which, surprisingly, can’t be installed via
apt
on the Pi Zero. This command will install the most recent LTS version of node.js by running a script from node-pi-zero:wget -O - https://raw.githubusercontent.com/sdesalas/node-pi-zero/master/install-node-v.lts.sh | bash
From Running Homebridge on a Raspberry Pi, Homebridge will require
git
to be installed:sudo apt-get install git
Those instructions also indicate that
avahi
must be installed:sudo apt-get install libavahi-compat-libdnssd-dev
Finally, we can actually install
homebridge
:sudo npm install -g homebridge
As well as
homebridge-pi
(which will provide thermal measurements from the Pi in Homekit):sudo npm install -g homebridge-pi
Before installing
homebridge-camera-rpi
(which will expose the camera to Homekit), we need to:- Activate the camera via
raspi-config
- Edit
sudo nano /etc/modules
and add the linebcm2835-v4l2
- Reboot
- Install ffmpeg:
sudo apt install ffmpeg
- Activate the camera via
Then, we can install
homebridge-camera-rpi
:sudo npm install -g homebridge-camera-rpi
And then setup the configuration file (
~/.homebridge/config.json
) to contain:{ "bridge": { "name": "PiZeroHomebridge", "username": "CC:22:3D:E3:CE:30", "port": 51826, "pin": "031-45-154" }, "description": "This is an example configuration file", "accessories": [ { "accessory": "PiTemperature", "name": "Pi Zero Temperature" } ], "platforms": [ { "platform": "rpi-camera", "cameras": [{"name": "Pi Camera"}] } ] }
Finally, I needed to add
homebridge
to my path viaexport PATH=/opt/nodejs/bin:$PATH
.- Now, you can run
homebridge
and add the devices to HomeKit configuration.
Configuring Homebridge to run on Bootup
There are great instructions for running Homebridge automatically at Bootup. These are the steps I used to configure it as a system service:
-
homebridge
to/etc/default
via this command:sudo wget -O /etc/default/homebridge https://gist.github.com/johannrichard/0ad0de1feb6adb9eb61a/raw/1cf926e63e553c7cbfacf9970042c5ac876fadfa/homebridge
homebridge.service
to/etc/systemd/system
via this command:sudo wget -O /etc/systemd/system/homebridge.service https://gist.github.com/johannrichard/0ad0de1feb6adb9eb61a/raw/1cf926e63e553c7cbfacf9970042c5ac876fadfa/homebridge.service
Fix path to the
homebridge
binary inhomebridge.service
with:sudo sed -i 's,/usr/local/bin/homebridge,'"$(which homebridge)"',' /etc/systemd/system/homebridge.service
Create a new user:
useradd --system homebridge
Per the camera setup instructions, add the new user to the
video
group:sudo adduser homebridge video
For convenience, I added the
pi
user to thehomebridge
group as well, so it can edit the configuration files:sudo adduser pi homebridge
Create a new directory for the configuration files:
sudo mkdir /var/lib/homebridge
Give the new user ownership of the configuration files:
sudo chown -R homebridge:homebridge /var/lib/homebridge/
Give the group write permissions for the configuration files:
sudo chmod -R 775 /var/lib/homebridge/
Log out and log back in (still as
pi
) to pick up the new permissions.Duplicate the configuration file in the new folder:
cp .homebridge/config.json /var/lib/homebridge/config.json
Make sure the ownership and permissions for
config.json
are set:sudo chown homebridge:homebridge /var/lib/homebridge/config.json
sudo chmod 664 /var/lib/homebridge/config.json
Have the system read the new configuration:
sudo systemctl daemon-reload
Enable it, start it up, and confirm it’s running:
sudo systemctl enable homebridge sudo systemctl start homebridge systemctl status homebridge
And with that, you can now just plug in the Raspberry Pi and it will boot and start up homebridge with your new camera! This is the cheapest way I’ve seen to get a HomeKit camera up and running.
Today is longer than yesterday. Things are looking up!
Stormtroopers in the building!
I just can’t get off of this Johnny Cash kick I’ve been on for the last two weeks.
Pro Tools Upgrade?
The last time I purchased Pro Tools was in 2012. I bought Pro Tools 10.0 for Students, which came with a miraculous four years of software upgrades for just a few hundred dollars. The last version I received under that plan was Pro Tools 12.4, in December of 2015. Four years on, that version is still working really well for me under macOS Mojave (10.14.6).
Avid announced some Cyber Monday deals that are still live until Christmas Eve, which has me investigating whether now is the time to upgrade. It looks like my options are:
- $199 for an upgraded Pro Tools perpetual license, with one year of active support (and new releases).
- If I can get education pricing through my wife, this reduces to $99/year.
- A subscription Crossgrade: $80 for year one (with a Cyber Monday promotion), $99 for year two, then $299/year.
- Apple’s Logic Pro X for $199.
The main driver for upgrading at all is Catalina support. It looks like the Avid Video Engine is the only part of 12.4 that isn’t 32-bit, and I don’t do anything with video, but I’m not sure if the bundle will work well with the embedded 32-bit binary. I don’t plan to update my machines to Catalina for a while, so this is more of a theoretical issue for at least a few more months.
I’m pretty sure I’ll go with a perpetual license when I finally upgrade. After the end of year two, it’s substantially less expensive than a subscription, and I’ve already demonstrated that I can easily live with an out-of-date version for a while. $299/year for a subscription doesn’t match the value I’m getting out of Pro Tools at this point in my life. Since there’s no current discount on a perpetual license upgrade, I’ll just wait until upgrading to Catalina forces my hand.