Hi fellow home automators,
as i’m trying to get all my security stuff implemented into Home Assistant, i’m still kinda stuck at the step of fully integrating my Hikvision WIFI-Camera (newest Gen DS-2CV2046G0-IDW).
- The cam itself is connected with Synology Surveillance Station through ONVIF
- Through the Synology-implementation i already got a live-view picture (and entity) of the cam-stream in Homeassistant --> this works!
- Cam: basic/digest-Modes are on for Web- and RTSP-Auth (for test purposes i also activated CGI-functions with basic/digest)
- Cam: User “hassio” exists in-Cam with the appropriate rights for "Notification/Alarm Triggers (Password is 16 digits !Important!; i wasn’t able to connect at all with longer passwords!)
- Cam: (Smart-) Motion Events are activated (Line Detection, Motion, Object,etc.) and linked with “Notification to Surveillance Station”
- Cam: Motion Events are set up with a drawn mask
My binary_sensor-config in Homeassistant is:
- platform: hikvision
After restarting Home Assistant i got the already well known WARNING, which as i far i understood it, is not important to the function:
Failed to parse headers (url=http://192.168.160.200:80/ISAPI/Event/notification/alertStream): [StartBoundaryNotFoundDefect(), MultipartInvariantViolationDefect()], unparsed data: ‘’
Well, after all this configuration, unfortunately the Home Assistant instance won’t create any binary_sensors for movement-detection at all.
I can see that the user hassio_mgmt is connected with the camera (connection between HA and Hikvision; Online Users-Panel inCamera).
Does anyone have an idea, what might be wrong here?
Any help is appreciated.
Thanks in advance and best regards
Stupid question, but 192.168.160.200 is the IP of the camera and not the Synology, right ? The hikvision integration uses the native Hikvision REST API, ISAPI, which is not forwarded through ONVIF.
If that is indeed the camera IP, can you access it from a browser ? Try 192.168.160.200/ISAPI/Event, that should give you a list of event triggers in xml format. If that works, then try this in the command line:
curl -v http://user:[email protected]/ISAPI/Event/notification/alertStream
This will open the event stream and print it out. You should see your events pass as xml data as you trigger them.
Thanks for your reply Alex.
That’s correct, the 192.168.160.200 is the IP of the camera itself. The Synology resides in a different subnet.
As for your question:
- Opening http://192.168.160.200/ISAPI/Event in a browser just showed me a blank page with the cameras favicon (it took about 5 sec until the blank page came up)
- Wgetting the same ressource gives me an 401 Unauthorized
- Adding login-credentials (hassio-user as well as admin) to the url (http://user:password@ip…) didn’t change anything --> 401
I didn’t try out the curl-command yet, as i thought that getting the ISAPI/Event would be the main priority, right?
Correct. The fact that you can’t get to that page over a browser hints at a problem that is out of scope for HA. If you manage to get it work in a browser, it will work with the HA integration. So getting access to ISAPI must be your priority.
So next question. Is ISAPI activated in your camera settings ? Go the camera config page -> Network -> Advanced settings -> Integration protocol. Make sure that Enable Hikvision CGI is checked and auth set to basic/digest.
Yes CGI is activated, which unfortunately didn’t change anything.
BUT, i found out something interesting: i played a little bit with the “hikvision test tool”, which is capable of authenticating itself with my account-credentials against the camera and got information states through ISAPI from the camera:
So, it seems that access somehow works, but maybe the ISAPI-paths changed in the past Camera-Generations, because when i try to parse for /ISAPI/Event i get an HTTP500 internal error.
Right now i got the Firmware-Version V5.5.132 build 200312 from April 2020 on the cam.
This is the output from /ISAPI/Event/notification/alertStream (just a GET)
That last output is what you would expect with the curl command above.
The ISAPI paths did not change with newer firmware. I just checked a random one of my 5 cams, it has firmware 5.6.2, and everything works as expected. My Hikvision NVR (which also supports ISAPI) has an older firmware 4.22.005, which also works as expected with ISAPI.
Unfortunately I can’t really think of anything else. But fact is, as long as you can’t get an authenticated access to ISAPI through the http REST interface, the HA hikvision integration will not work.
Edit: are you 100% sure your camera user has the appropriate rights ? Try with the default admin user.
Thanks for your feedback Alex.
For me it seems, that the past few tries with the tool worked fine and the authentication went through. Otherwise i wouldn’t have got those replies with actual data and information.
What i also see is, that the home assistant is continuously connected with the provided account with the camera itself:
I’m now gonna try the hikvision integration with the admin account…i’ll keep you posted
Edit: Right now the hassio_mgmt (my chosen account for that connection) got full Operator rights with all the checkboxes ticked (but especially that “Notify Surveillance Station…” Box).
Edit2: Using the actual admin-account unfortunately didn’t change anything. the cam now shows me an existing connection between home-assistant with the admin account, but no binary_sensors… :-/
Under normal operation, that is to be expected, as HA needs to keep a connection open to the event stream. Did you try to stop HA and connect using the browser only ?
Using the admin-account unfortunately didn’t change any behaviour.
Alright tomorrow i’m gonna shutdown Home Assistant completely and restart the camera as well. let’s see what happens.
I’m out of ideas then, sorry. Maybe someone else can help.
Oh and just to make this clear, just in case : the binary sensors are only added when HA starts up, they aren’t added on the fly when you enable them in the camera.
where could I find the tool you mentioned (hikvision test tool) ?
hey, is it possible to share that hikvision test tool?
I’m sorry for the late reply. Unfortunately i couldn’t find the ISAPI-Tool vom Hikvision on my notebook anymore. Originally i had it from a forum, where it was shared on a yandex-disk, which isn’t avaliable anymore.
Sorry to let you down guys.
no problem, found it already
i believe it was this one, though i dont use it
Hi, can you reshare this test tool? The download link above was deleted. Thanks!