Can't load HikVision Binary Sensor

I hope someone can help me with this. I searched around and couldn’t find an answer to this.

I am running HA 0.74.0. My camera is DS-2CD2432F-IW running v5.4.5. I followed all the instructions and suggestions but I can’t get my HikVision cameras binary sensors working. I am trying to automate lights on/off when motion or line crossing is detected. I added the following to my configuration.yaml file:

Binary Sensors

binary_sensor:
platform: hikvision
host: 192.168.1.62
username: user
password: pass

My camera motion and line crossing works because I get notification form the camera when either happen. So I know its not the camera. I have all the triggers and authentications enabled on the camera. Where do I go from there. Can anyone please guide me through this?

Thank you all!

1 Like

check your authentication type, needs to be digest/basic:

2 Likes

What version of the firmware are you running on your camera?

I’m on 5.5.0 now but started on 5.4.x

I followed your instuctuions. When I go to entity_registry.yaml I see the following:

binary_sensor.ip_camera_motion:
config_entry_id:
name:
platform: hikvision
unique_id: 76766ijhk-e81d-11b4-443e-uuhkjhnkhj6t5756.Motion.1
binary_sensor.ip_camera_line_crossing:
config_entry_id:
name:
platform: hikvision
unique_id: 76766ijhk-e81d-11b4-443e-uuhkjhnkhj6t5756.Line Crossing.1

How come config_entry_id and name a blank? My camera name is FrontDoor. Shouldn’t those be populated with the camera name?

Delete that block, and restart HA.
it’ll be recreated automatically

Yep. All works now. Thank you!

1 Like

Hello,
I’ve got a similar problem, my sensors are there but the dont change states.

I’ve got :

  • Model : DS-2CD2443G0-IW
  • Firmware Version : V5.5.61 build 180718
  • Encoding Version : V7.3 build 180717
  • Web Version : V4.0.1 build 180626
  • Plugin Version : V3.0.6.43

I’ve got in my config :

- platform: hikvision
  name: cam3
  host: 192.168.0.202
  username: admin
  password: blabla123
  ssl: false

admin / blabla123 being the credentials I use in the web UI of the CCTV

I’ve also deleted all the hikvision entities in entity_registry.yaml

Then I’ve restarted HAss, and I get plenty of new binary sensors, I see in the logs for example

2018-10-08 11:16:37 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.hikvision entity: binary_sensor.cam3_motion

3

But the issue is that I’m trying to use the motion detection, and the sensor never change its state !

more config…

I found the issue after watching videos of Hik setup…
I had to click on the picture and create a red grid on it, to make an area of motion detection.
Watch out, it only works on IE (not Edge/Firefox/Chrome)

I also tried to use the HikVision integration in HA. I’m using a DS-7604NI-K1 NVR with 1 camera connected. I can view the network stream over RTSP and also integrate that in HA. Now I want the motion and line crossing sensors.

First problem, I can’t find both of the CGI-Bin authentication methods as described above. I’ve found and enabled the option under System->Security and set that to Digest/Basic. The option Under Network->Advanced settings doesn’t exist. I’ve only the tabs SNMP, Email, Platform acces, HTTPS and “Overig” (something else).

The connection between HA en the NVR is oke. I’ve tried to configure the module with a wrong user/password and then I see Authentication errors in the HA log. I’ve corrected the username/password but now I don’t see any error, BUT also none of the hoped sensors.

I’ve first tried with a quite empty config
binary_sensor:

  • platform: hikvision
    host: 192.168.4.60
    port: 80
    ssl: false
    username: xxxxxx
    password: xxxxxxx

And after that I tried with:
binary_sensor:

  • platform: hikvision
    host: 192.168.4.60
    port: 80
    ssl: false
    username: xxxxxx
    password: xxxxxx
    customize:
    motion_1:
    delay: 30
    line_crossing_1:
    ignored: false
    field_detection_1:
    ignored: false

Both gives me the same result. No error message but also no sensors. Does anyone has an idea what the problem is?

Did you restart home assistant after you added the binary_sensor?

Yup, I’m trying to fix this for two weeks with a lot of retries and restarts of HA.

This is how I have my Hikvision setup in the binary_sensor.yaml file:

#Front Door Camera
platform: hikvision
host: 192.168.1.63
name: front_door_cam_sensors
username: admin
password: xxxxx

After saving the file I SSH’d into HassIO and run “hassio homeassistant restart” command, without quotes.

Hmmm strange. I’ve tried to copy that to my config. No error message but also no new sensors.

Maybe I found the problem. At the top of this topic it is described that the Hikvision CGI options and authentication must be turned on. My NVR does not have all that menu items.

I found the option “System-> Security-> Authentication” and put it on “digest / basic”.

I can not find the other option. Under “Network-> Advanced Settings-> Integration protocoll” and then the checkbox “Enable HikVision-CGIU” and the CGI authentication dropdown is not there, so I can not put it on digest / basic. The whole menu items ’ Integration protocoll’ is not there, the last option is ‘Other’.

Are you trying to set these options on the NVR or on the camera itself?
As far as I know you need to provide the camera details, not the NVR…

Nope I tried to connect to the NVR. As I read in the documentation this is possible:
When used with a NVR device the sensors will be appended with the channel number they represent. For example, if you configure an NVR with the name “Home” that supports 2 cameras with motion detection and line crossing events enabled to notify the surveillance center the following binary sensors will be added to Home Assistant:

  1. binary_sensor.home_motion_1
    
  2. binary_sensor.home_motion_2
    
  3. binary_sensor.home_line_crossing_1
    
  4. binary_sensor.home_line_crossing_2
    

See: https://www.home-assistant.io/components/binary_sensor.hikvision/

Directly connect to the camera’s isn’t possible, because the IPTV cams that are connected to the NVR are in a different subnet that the my home automation and the NVR itself. My HA server got 192.168.4.100 ipadres, the NVR got 192.168.4.60. The camera’s behind the NVR got 192.168.254.x range.

Found the problem.

You must check Notify Surveillance Center at the linkage methode. After checking that and restarting HA, the sensors are added. Damm it could be quite simple when you know the solution.

1 Like

Nice find. Might be worth a PR to update the doc?

I’ve got DS-7216HGHI. I turned on the Notify Surveillance Center everywhere, but I don’t have “digest / basic” option in the configuration.
HA sees the motion sensors, but the entities don’t change.
I have analog cameras. Could it be the problem?