Cameras in HomeKit, let’s go!
Since deciding to use Apple’s HomeKit as my smart home platform (see Adventures with Apple TV), it’s time to add in our home security camera system. Enter the DVR that runs the cameras:
HIKVISION DS-7108HGHI-F1 8-ch 1080p Lite Mini 1U H.264 DVR
It’s a basic unit that uses HikVision’s app for remote viewing. It’s not a great experience so best to give it that sweet HomeKit integration.
Hardware and Software Decisions
While browsing r/homebridge, I came across this post talking about a new platform called Scrypted that is “primarily focusing on making camera experiences seamless”.
With comments like this, it looked super interesting:
Checking out Scrypted’s GitHub, I saw that the owner was koush. That name would be familiar to anyone from the early Android rooting/modding scene! Took me back to the fond memories of flashing nightlies with ClockworkMod (and later TWRP) on my Motorola Defy. Anyway, back on topic, Scrypted was the perfect candidate to use instead of my existing Homebridge setup.
As for hardware, my cute little Raspberry Pi Zero W’s lack of processing power, RAM and Ethernet meant it’d be ill-equipped for this task. A Pi 4 would have been ideal but thanks to the supply shortage I went with a Pi 3B+ instead.
Shopping List (with costs @ 19/08/2022)
- Raspberry Pi 3B+ – R600 – Second hand via Gumtree
- Micro SD Card (used an old Samsung EVO+ U1 32GB SD)
- Raspberry Pi Official 2.5A Power Supply (used an old one)
- Ethernet Cable (used an old one)
Important Notes!
The project scope was simply view the cameras via Apple Home. I’m not using the motion sensor functionality or any features of HomeKit Secure Video. Also, I’m using macOS so screenshots/steps may differ from your experience on Windows/other OS. An addendum was added with updated steps at the bottom of this post. Read it first!
Step 1 – Flashing Raspberry Pi OS
First we install Raspberry Pi OS Lite on the SD card. For those (like me) that are used to flashing using Etcher, adding ssh file to boot and SSHing into the Pi using default credentials, that method doesn’t work since April 2022. Whether you understood the previous sentence or not, you’ll need to use Raspberry Pi Imager now. (Download it from here). Select the appropriate “LITE” version for your Pi:
Then tap the “cogwheel” icon, set an appropriate hostname (I used scrypted.local), enable SSH and set a username and password:
Save, choose your SD card and click “WRITE”. After it’s done, put the SD in your Pi, connect it to power and your router.
Step 2 – Installing Scrypted
Once the Pi boots up and connects to your network, open Terminal and SSH into the Pi using the credentials from Step 1 (Guide to SSH here).
I chose to use the Local Installation method (see other options under Installation here) so I copied the snippet from here pasted into Terminal and hit Enter:
This is where you jump to Step 3 and Step 4 while you wait for the installation to complete.
Step 3 – HikVision DVR Static IP Setup
You’ll need to assign your DVR a static IP address. Don’t skip this as if the IP of the DVR changes, the entire setup breaks. Google your router/access point model and “set static IP” for a guide.
eg. TP-Link refers to this feature as “Address Reservation” in it’s Deco app
Step 4 – HikVision DVR Setup
Following the Scrypted HikVision plugin setup, iVMS-4200 was installed to remotely configure the DVR.
Open the app and complete the following steps:
- If your DVR is connected to your network and is working correctly, it should appear here. Click on it.
- Click “Add to Client”, give it a Nickname and enter the username and password you used when initially setting up the DVR.
- If added correctly, it’ll appear here. Click on it.
- Click Remote Configuration
Using the recommended settings for the Scrypted HomeKit Plugin, set up the cameras and save:
That’s the end of the iVMS-4200 setup.
Step 5 – Scrypted Setup
By now, the Scrypted setup in Part 2 will have completed and it’s now running on your Raspberry Pi at <yourhostname>.local:10443 (in my case: https://scrypted.local:10443)
Open a web browser to that URL, accept the certificate error (if you understand the implications), complete any steps and get to the plugin screen:
- Click Install
- Install the Hikvision, HomeKit and Snapshot plugins
- Your Plugins list should look the same as mine after installing the above.
Step 6 – Scrypted HikVision Camera Plugin Setup
Click on the HikVision Camera Plugin and click on Add Device:
Give it a Name and Click Create.
Then, click on “General” and add in the DVR username and password (from Step 4) and the IP Address from Step 3. Click the green “submit” arrow after typing each one:
Then in the Advanced tab, under Channel Number, put in 101 for your first camera (When adding subsequent cameras, use 201, 301 etc).
After this step, you can verify that the plugin is working by clicking on “Stream: Stream 1” and seeing that there’s a Detected Resolution and Bitrate present. Also the black rectangle on the left will change to show a snapshot of the camera’s feed:
Now go to the Integrations and Extensions tab and tick HomeKit and Snapshot Plugin:
I use the Snapshot plugin to fix an issue where the snapshots weren’t the same aspect ratio as the video. To do this, go to the Snapshot tab and tick “Snapshots from Prebuffer”:
Then click on the HomeKit Pairing tab and tick “Standalone Accessory Mode”:
Then, per the instructions in the screenshot, Reload the HomeKit plugin by going to the plugin settings, then HomeKit and click the “Reload Plugin” button. When you come back to the HomeKit pairing tab for your camera, a QR code will be waiting there for you to scan!
Step 7 – Adding Cameras to HomeKit
Open the Home app on your iPhone, tap the “+” on the top right and “Add Accessory”. Scan the QR code and follow the prompts to add the camera.
Repeat the above steps from Step 6 and Step 7 to add all your cameras.
Woohoo, Cameras on all the Devices
Once you’ve started adding cameras, they’ll start appearing on your Apple TV and in the Home apps of your iPhones, iPads, MacBooks and Apple Watches (if you’ve signed into iCloud and enabled this on all your devices).
Post-Implementation Summary
Cameras are now integrated into the Home app on all my Apple Devices with reliable, fast streaming and secure sharing with others via Apple ID. Also, I can just ask Siri to “show me the driveway” on any device and the feed will just appear. First party integration is AWESOME.
My Smart Home Setup after this Implementation
How I see the interplay between apps, cloud providers and controlled devices may not and, in some cases, definitely doesn’t reflect reality. I just use it as a handy map. See how I got to this stage by reading these posts.
The Future
Adding Scrypted gives me access to all the cameras but also adds motion sensing capabilities from the camera’s feeds. The next step for me is to explore getting motion events setup and then triggering lights (and other automations) based on these events. Exciting!
If you have any questions/would like to share your experience with HomeKit camera integration, leave a reply below. To receive an email when I publish a post, subscribe here. Till next time!
(Featured image remixed from this photo)
Update (28/04/2023)
Since the post was published on 03/09/2022, I’ve had to re-install Scrypted from scratch. Here’s an update showing changes to the steps in the above guide.
Step 2
Instead of using the Local Installation method, I used the recommended Docker Compose snippet from here. When prompted, I entered “y” when asked to install Docker and “n” to decline setting up external storage.
Step 4
One additional task was adding a dedicated “scrypted” user to be used in subsequent steps:
Step 5
I only installed the HikVision and HomeKit plugins. I suspect that the Snapshot Plugin was causing excessive CPU load on my (slow) 3B+. Note plugin versions:
Step 6
The HikVision plugin setup has changed since v0.0.101 used above. Instructions for v0.0.126 below:
After clicking “Add Device”, a new popup appears which you’ll populate as below (Username and Password from the new user created in Step 4):
After clicking “Create”, add your first camera using Channel 101 and click “Save” (subsequent cameras will be 201, 301 etc):
To give your camera a new name, click on “Edit”, change the name then Save:
Click “Extensions” and tick HomeKit:
Click “HomeKit” then Pairing to see the QR for you to scan into HomeKit. A page reload may be required to see the QR code:
Closing Notes
As the plugins and Scrypted receive updates, this guide will once again become out-of-date. For more help, you can join the Scrypted Discord (link) and check/post in the relevant #hikvision channel.
Good Morning Kavi, hope you are well, my apologies for reaching out. I stumbled onto your blog a couple of days ago around adding Hikvision DVR to Apple HomeKit. Jumped straight in with both feet. Got everything working except for the fact that I am only able to load one camera. Even when I adjust channel from 101 to 201 to 301 during second camera setup it still shows the first camera feed. Any ideas for me please?
Hi Jacques,
You’ve chosen a cool project to work on. Having your cameras in HomeKit is really awesome.
I first validated that my cameras were streaming correctly by checking the RTSP streams using VLC. Example RTSP URLs can be found here. If you can see all the cameras in VLC using the expected “ID” values but these are not working in Scrypted, I’d suggest joining the Scrypted Discord (link) and ask in the relevant #hikvision channel.
Good Luck!