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

  1. Using balenaEtcher, I installed the September 2019 version of Raspbian Buster Lite (link to latest release) on my SD card.
  2. I enabled ssh access by creating an empty file named ssh at the root of the SD card.
  3. 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
    }
    
  4. 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>.

  5. It’s important to change the pi account password with the passwd command.
  6. I selected my time zone and set the locale to en_us.UTF-8 via sudo raspi-config.
  7. Finally, I updated the software with:

    sudo apt-get update
    sudo apt-get upgrade
    

Install Homebridge, homebridge-pi, and homebridge-camera-rpi

  1. 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
    
  2. From Running Homebridge on a Raspberry Pi, Homebridge will require git to be installed:

    sudo apt-get install git
    
  3. Those instructions also indicate that avahi must be installed:

    sudo apt-get install libavahi-compat-libdnssd-dev
    
  4. Finally, we can actually install homebridge:

    sudo npm install -g homebridge
    
  5. As well as homebridge-pi (which will provide thermal measurements from the Pi in Homekit):

    sudo npm install -g homebridge-pi
    
  6. 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 line bcm2835-v4l2
    • Reboot
    • Install ffmpeg: sudo apt install ffmpeg
  7. Then, we can install homebridge-camera-rpi:

    sudo npm install -g homebridge-camera-rpi
    
  8. 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"}]
        }
      ]
    }
    
  9. Finally, I needed to add homebridge to my path via export PATH=/opt/nodejs/bin:$PATH.

  10. 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:

  1. Download these files:

    • 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
      
  2. Fix path to the homebridge binary in homebridge.service with:

    sudo sed -i 's,/usr/local/bin/homebridge,'"$(which homebridge)"',' /etc/systemd/system/homebridge.service
    
  3. Create a new user:

    useradd --system homebridge
    
  4. Per the camera setup instructions, add the new user to the video group:

    sudo adduser homebridge video
    
  5. For convenience, I added the pi user to the homebridge group as well, so it can edit the configuration files:

    sudo adduser pi homebridge
    
  6. Create a new directory for the configuration files:

    sudo mkdir /var/lib/homebridge
    
  7. Give the new user ownership of the configuration files:

    sudo chown -R homebridge:homebridge /var/lib/homebridge/
    
  8. Give the group write permissions for the configuration files:

    sudo chmod -R 775 /var/lib/homebridge/
    
  9. Log out and log back in (still as pi) to pick up the new permissions.

  10. Duplicate the configuration file in the new folder:

    cp .homebridge/config.json /var/lib/homebridge/config.json
    
  11. 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
  12. Have the system read the new configuration:

    sudo systemctl daemon-reload
    
  13. 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.

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.