IP Cameras in HomeKit: Homebridge Plugin

IP Cameras in HomeKit: Homebridge Plugin

Introduction

This guide should work for any IP camera that outputs an RTSP/RTMP stream, but there may be some differences from the camera that I’m using within this guide.

Before getting started, I recommend setting a static IP for your IP camera. You can do this on almost all routers, but the steps will be different. Just search for the name of your router + ‘DHCP assignment’ and follow the instructions presented!

This guide will assume you have an instance of Homebridge up and running. If you don’t, Homebridge provides easy to follow instructions for a range of different devices and OS’s here.

Homebridge Setup

Previously, you would need to install FFmpeg separately. However, it is now compiled within the homebridge-camera-ffmpeg plugin. To install this plugin, run the following command:

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

Before adding the plugin to Homebridge, you’ll want to find out the RTSP stream URL for your camera. Getting this will differ depending on the camera you have. I used the below steps to get this for the camera I’m using:

  • Open the SimCam app and press the Settings cog on the camera you want to add.
  • From this list, select ‘Camera Information’.
  • Press the ‘Obtain’ button on the option ‘RTSP streaming address’.
  • Note this URL, as you will need to include it in your config.json.

Now you have the RTSP address, open your config.json and add the following code underneath the platforms header. Substituting RTSP URL for your own camera’s address.

{
    "platform": "Camera-ffmpeg",
    "cameras" [{
        "name": "Camera Name",
        "manufacturer": "Manufacturer",
        "model": "Model",
        "videoConfig": {
            "source": "-re -i RTSP URL",
            "videoFilter": "none",
            "vcodec": "copy",
            "maxBitrate": 200,
            "packetSize": 1128
            }
        }
    ]
}

The above config has worked best for my IP Camera, giving a low latency feed both at home and away. You can also change the camera name which dictates how the camera appears in HomeKit.

After saving your config.json restart Homebridge. Unlike most accessories, it won’t appear immediately, this is because it needs to be added directly, and uses the same setup code as your main Homebridge pin.

To add the camera to your HomeKit system:

  • Open the HomeKit app and press the + button.
  • Select the option ‘I Don’t Have a Code or Cannot Scan’.
  • Your SimCam camera will be listed at the top under ‘Nearby Devices’, then click on the camera’s icon.
  • Enter your Homebridge Code.

I’m extremely happy with the end results of this project, and it has definitely improved the usefulness of the SimCam cameras for me. Getting me one step closer to my grand quest for every smart product I buy to work in the Apple Home app. If you have questions about this setup, please drop me a comment below and I’d be more than happy to answer them!

Sam Brooks

Sam Brooks is the founder and creator of Techtrail. He works as a Broadcast Engineer, and has a great enthusiasm for smart home, 3D prototyping, and emerging technologies.