Edit: This thread is old and no longer accurate. While I cannot provide details, there is an integration for Hikvision cameras that may make things easier, however I simply used “Generic Camera” integration for all my HK cameras at first, then I adopted Scrypted to pull from the NVR and feed HA.
I struggled quite a bit to make a subset of my security cameras work with Home Assistant so I figured I’d share my findings as the posts I read were either incomplete or inaccurate for my use case.
All my cameras and my NVR (7732) are Hikvision so what I am writing may not apply to you if you have different hardware.
Below is the configuration that finally worked.
One might believe that stating username and password both separately and in the RTSP URL is redundant, however I have found that listing them separately is needed for the still image, while the RTSP URL needs the username and password as part of the URL.
username: "username"
password: "password"
In the configuration I pasted below, replace the NVR-IP with the IP of your NVR. This will be the same for all the cameras on your NVR.
still_image_url: http://NVR-IP...
The port used for the still picture is sequential starting from 65000. You will notice that each camera has a different port… 65001, 65002, 65003, etc. This is what determines the camera the still image is from. The 102
should be equivalent to Channel 1, Substream 2. It might be possible to change the substream to the main stream by using 1
(thus 101
) but it is unnecessary as the image is just for the card so a larger image (8MP in my case) would just use more resources unnecessarily. Do not try to change the Channel number as done for the streams as it will not work (at least on a Hikvision 7732 NVR)
still_image_url: http://NVR-IP:65001/ISAPI/Streaming/channels/102/picture
For the stream RTSP URL, the format for the Hikvision NVR is as shown below. The port here stays the same. The default RTSP port is 554 so unless you changed it, leave it at 554. The channel number determines the Channel and the stream for each camera. In the example below, it is Channel 1, Stream 1. If you want a lower resolution stream to help with resources, you can use 102. The next camera is 201, and so on.
stream_source: rtsp://username:password@NVR-IP:554/Streaming/Channels/101
Even with all of this in the configuration, I was having issues with the still image showing up for some cameras and others not. Taking a step back, the username and password I used for this is an “Operator” level login, not an Administrator one. I have these logins set both in the NVR and the IP Cameras - all the same. For some reason, I had to go to the Security tab of all the IP Cameras that were refusing to give me a still image and re-save (writing the password in again) the Operator login password. Instantly the still image appeared on the dashboard. The confusing bit is that I am interfacing with the NVR and the password there is clearly correct as I use it in other applications and some of the cameras were working… Anyhow, pulling the still image per IP Camera appears to need the same credentials to be stored on the IP Camera itself… and even if they are (like my case), I had to refresh them (no idea why… maybe the password was not what I thought it was and never noticed given I switched to using an NVR).
I hope to save some people the grief and research I had to go through to get it working by detailing my observations. I’m not an expert in IP Cameras so take this with grain of salt.
#IP Camera Configuration
camera:
- platform: generic
name: Entrance Camera
username: "username"
password: "password"
authentication: digest
still_image_url: http://NVR-IP:65001/ISAPI/Streaming/channels/102/picture
stream_source: rtsp://username:password@NVR-IP:554/Streaming/Channels/101
- platform: generic
name: Driveway West Camera
username: "username"
password: "password"
authentication: digest
still_image_url: http://NVR-IP:65002/ISAPI/Streaming/channels/102/picture
stream_source: rtsp://username:password@NVR-IP:554/Streaming/Channels/201
- platform: generic
name: Driveway East Camera
username: "username"
password: "password"
authentication: digest
still_image_url: http://NVR-IP:65003/ISAPI/Streaming/channels/102/picture
stream_source: rtsp://username:password@NVR-IP:554/Streaming/Channels/301
- platform: generic
name: Backyard Camera
username: "username"
password: "password"
authentication: digest
still_image_url: http://NVR-IP:65004/ISAPI/Streaming/channels/102/picture
stream_source: rtsp://username:password@NVR-IP:554/Streaming/Channels/401
- platform: generic
name: Garage Camera
username: "username"
password: "password"
authentication: digest
still_image_url: http://NVR-IP:65005/ISAPI/Streaming/channels/102/picture
stream_source: rtsp://username:password@NVR-IP:554/Streaming/Channels/501