How To Setup A HomeKit Camera For Free — iOS Home App

Apple’s smart home system, HomeKit, is a really nice way to make your smart home dreams come alive but it requires hardware that has been certified under Apple’s MFI program. This is a good choice for Apple, and ultimately customers like us, since it gives the “it just works” experience that the modern Apple is known for; the obvious downside is that if you want to dip your toes in the water before buying a ton of hardware there is no obvious way to do that. Check out this interesting article about the process of bringing a HomeKit device to market here — https://medium.com/@KeenHome/what-it-takes-to-be-homekit-compatible-c253496e79d9 .

That’s where that old dusty Raspberry Pi you have sitting in your desk drawer comes in! Any respectable home hacker or tinkerer probably has one that they bought for a project that didn’t work out and now is the time to put it to use as a bare bones HomeKit device. If you don’t already have the stuff listed below this wont be free but it is still way cheaper than buying the off-the-shelf HomeKit gear.

What you’ll need:

Setup RPi:

Head over Raspberry Pi website and download the latest version of Raspberry Pi OS and flash it to your sd card: https://www.raspberrypi.org/downloads/

Plug in camera module and install sd card.

Boot up your RPi and connect a monitor & keyboard. Go through the onscreen setup instructions to connect to wifi.

Turn on ssh and camera in the Raspberry Pi config menu. Make sure you set a new user password so that ssh is not enabled with the default password of raspberry .

sudo raspi-config

Check the IP address of your RPi.

ifconfig

At this point I switch back to my main computer and do the rest via ssh. Connect to Pi via ssh. You’ll need to replace the ip address with the address for the pi on your network, in my case 192.168.1.3. More info here — https://www.raspberrypi.org/documentation/remote-access/ssh/README.md

ssh pi@192.168.1.33

Once you’re connected to the RPi via ssh it is a good idea to run an update on the system if you didn’t do this as part of the Raspberry Pi OS setup.

sudo apt-get update -y && sudo apt-get -y dist-upgrade

Add the pi user to the video group for access to the camera

sudo usermod -a -G video pi

Test that the camera is working by saving a picture locally.

raspistill -o test.jpg

You can copy this back over to your main computer using scp in a new terminal window. Open it up and make sure things look like you expect. If you’re like me you’ll have a crappy looking picture of the ceiling above your desk! The command below will copy the file back to your computer in the current directory.

scp pi@192.168.1.33:test.jpg .

Now we will setup HomeBridge which will allow our Raspberry Pi to opperate as a HomeKit device. More info on the HomeBridge project is on their github page here — https://github.com/homebridge/homebridge

Install Prerequisites:

Install recent node JS from https://github.com/nodesource/distributions/blob/master/README.md

curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs

Check that everything worked by asking for the node version

node -v

Install HomeBridge:

sudo npm install -g --unsafe-perm homebridge

Install HomeBridge UI and setup

sudo npm install -g --unsafe-perm homebridge-config-ui-xsudo hb-service install --user homebridge

If all worked you should see something like this in your terminal.

Configure HomeBridge:

To access the web UI for further configuration you can copy and paste the url into your browser. For me:

http://192.168.1.33:8581

Log in using the admin name and password (don’t forget to change pw). You should see a screen like this with all the important info on your HomeBridge.

Now we need to install the camera plugin. You can do this via the HomeBridge web interface or directly from the command line. To do it from the command line use the following command. For more info on the this plugin, check out the github page- https://github.com/Sunoo/homebridge-camera-ffmpeg .

sudo npm install -g homebridge-camera-ffmpeg — unsafe-perm

You will need to add a couple things to your config.json file to tell HomeBridge where to look for the camera. See below for my config.json.

Setup Home App On iPad:

This part is really easy, as you might expect of an Apple experience :) . Grab your iPad or iPhone and open up the Home app. You click on add accessory and scan the QR code from the HomeBridge web UI.

You will be guided through the steps and will have to click to acknowledge that this accessory is not verified by Apple (see top of article). Then you’ll be all set. HomeKit works through your apple ID so you should have access to the camera from other iOS devices as well.

Note — This is just the quick setup to let you play around with HomeKit without buying a bunch of stuff. If you plan to continue using HomeBridge on the RPi, you should do some additional work to make sure that your network connections and configuration are secure. Change the default passwords and review your settings.

Note2 — The Amazon.com links posted above are affiliate links, if you buy through them I will get a small portion of the purchase price. The pricing for you will be the same if you use them or search for the item on Amazon without using the link. I don’t have any particular affiliation with those products and don’t think they are any better than similar options but if you don’t know what you are looking for they may save you some time.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store