Revisiting Homekit USB Webcam on Raspberry Pi 3

On home HomeKit setup, some homebridge plugins (Nest, WeMo) needed updating. And flaky webcam performance needed addressing. It was also time to update the node.js install. Got it all completed.


node.js and homebridge+plugins re-install

Before troubleshooting the camera, update all the things. As nvm was already installed, used it to update node + npm.

nvm install node

# upgrade to latest npm on current node version
nvm install-latest-npm

nvm alias default node

# system-wide node links
file `nvm which node`
NODE_BIN_DIR=$(dirname `nvm which node`)
sudo ln -sf ${NODE_BIN_DIR}/node /usr/local/bin/node
sudo ln -sf ${NODE_BIN_DIR}/npm /usr/local/bin/npm

# Now install the homebridge modules
sudo apt-get install -y libavahi-compat-libdnssd-dev
sudo npm install -g --unsafe-perm homebridge

# plugins
sudo npm install -g homebridge-platform-wemo
sudo npm install -g homebridge-nest
sudo npm install -g homebridge-camera-ffmpeg

# system-wide link that systemd service uses
sudo ln -sf $(which homebridge) /usr/local/bin/homebridge

Webcam improvements

I am still using the Logitech C615 USB webcam plugged into a Pi 3 B. Previous HomeKit post covers installation of required software and system components in Raspbian.

Updated Settings in config.json

Notable changes:

  • there is now an explicit “stillImageSource” that turns some ffmpeg knobs to improve reliability of snapshots.
  • the re switch is for “real-time” style streaming that is useful if the source stream is a file, in this case /dev/video0
  • videoProcessor” is a local built-from-source ffmpeg binary. This is not necessary as the ffmpeg binary available in Raspbian stretch has all the required runtime configs.

Using systemd to Start homebridge on Bootup

Using instructions at Running Homebridge on a Raspberry Pi for Running Homebridge on Bootup (systemd) there is a homebridge.service file that was already installed.

Test changes to config.json for homebridge running under systemd

sudo systemctl restart homebridge
sudo journalctl -f -u homebridge | less -F

Press Ctrl-C to stop live log file streaming and q to quit less

See previous posts for more debugging ideas if problems are encountered.

What it looks like?

In “[Home]” tab, if you have the camera designated as a “Favorite”



Published on August 25, 2018

Must affirm third-party consent for Disqus comments to appear.