DS-KD8003 - DS-KV8113 - DS-KV8213 - DS-KV6113 - DS-KV8413 and .... integration Hikvision HikConnect Video intercom doorbell

I have a KV-6113 on FW 2.2.43 -should I upgrade or wait for a new release?

Devs, any thoughts on the easiest way to get this working for a KV-6113? I have a HA running on a Rpi3, and Homebridge running on Rpi4 and have a spare windows 10 NUC.

I just want to get the event stream inside my ecosysttem somehow

Callstatus should work, no custom firmware needed

hello pergola fabio
sorry for my english I write from google translation

I had some question I have been on the subject for a little while but I do not understand certain thing …
I have a videophone ds-kv6113 firmware 2.2.53 a l 'purchase on the other hand I am on Yeedom … I would like to recover the callstatut … locally if possible and to know if a new custom firmware is planned for those who buy the videophone like me already updated …

and another question i am using it in standalone and no way to get the sd card to work any idea when a future firmware will include the sd card?

(you often talk about the SDK as a rescue solution but I have no idea how to use it).

thank you for your time

Hi, if ISAPi doesn’t work on your model, the SDK is an alternative… A guy has written a script to retrieve events based on official SDK from hikvision…

See link below… But there is no integration yet, you need to add some extra lines to make for example a rest command to HA … But be aware, the SDK is limited to windows and some Linux OS… So alpine (HassOs) is not supported, you need to build your own add-on or docker for example

I hope some python developer here can create a custom/add-on component, so it’s easy to install for everyone…

But I tested script , it works verry good and not based on poll

1 Like

For the guys interested in the SDK, i created an addon based on @laszlojakab python script… i’m not a developer, so its some hardcoded stuff… this will work for DS-KD8003 owners, wo already updated to the last official firmware with no custom isapi support… offcourse other hikvision models are supported too…

Ok, first of all, create a template sensor in your yaml

  - platform: template
    sensors:
      hikvision_test:
        value_template: "Hikvision TEST"

Download zip, and place it in your “addon” folder, then you can install the local addon, as a normal addon… the addon is based in debian slim 3.7, since it doesnt run on Alpine (hassos) users

So after copy/paste, change line 73 in hik.py, setup your ip of outdoorstation and password

user_id = HCNetSDK.NET_DVR_Login_V30( "IPOUTDOORSTATION".encode('utf-8'), 8000, "admin".encode('utf-8'), "YOURPASSWORD".encode('utf-8'), device_info)

Change line 100, i’m using REST api commands to update the template sensor, see example screenshot below, the XXX you need to replace by your bearer token offcourse… mine HA runs local on http, so if you are using https locally, change that also offcourse…

'Authorization': 'Bearer XXXXX',

you can see for example, after a doorpress button, i set the callstatus to “on” for 1 second, you can see that at line 26

Its a little bit hard coded, but it works… if there is a python developer here who can improve!.. pls post

This SDK , the “lib” from hikvision doesnt run on ARM / Alpine, so therefore my docker image is based on debian, therefore its also not possible to create a custom component (hassos users)

2 Likes

Thank you Fabio pergola for your information and the responsiveness of your answers …

I will test for the SDK this weekend when I come back from travel

Thank you very much

@pergola.fabio I more and more tend to attach an ESP board in order to catch the doorbell ringing events. Because I use hassOS and don’t want to have more than my raspberry pi running only to use the SDK…
Have you ever described in detail how you attached the ESP to the Hikvision? Can you share sind wiring, configuration of the D1 mini or whatever you use?
Thanks in advance!

Yeah, it was verry easy, my indoorstation had 2 output relays, in ivms i enabled “call linking” …

Then just hooked up an esp, created a binary sensor in esp, … Just wire one cable to GND and 1 wire to whatever pin you like … but be aware , if I remember correctly,. Output voltage was higher then 3,3 , so pull it down with resistor divider…

Edit: sorry, my mistake, there was no voltage on that output relay, it was just a normal open/close relay…

I also captured the door relay, there offcourse was voltage, i divided that

but the add-on is verry small, its a light weight docker…
much easier, i run it too now on hassos, you can have more then just call status, it also triggers motion detection , door open events, swipe events …
no wire needed, no esp, no esp add-on ?

My dream to do this on Yeedom with my Ds-k6113 …

I posted all info also on yeedom, there was a guy there that was converting my scripts
edit: posted all here, see latest replys

I keep running into errors in Hassio with this - here is the log

Traceback (most recent call last):
  File "hik.py", line 1, in <module>
    from hcnetsdk import HCNetSDK, NET_DVR_DEVICEINFO_V30, NET_DVR_DEVICEINFO_V30, NET_DVR_SETUPALARM_PARAM, fMessageCallBack, COMM_ALARM_V30, COMM_ALARM_VIDEO_INTERCOM, NET_DVR_VIDEO_INTERCOM_ALARM, NET_DVR_ALARMINFO_V30, ALARMINFO_V30_ALARMTYPE_MOTION_DETECTION, VIDEO_INTERCOM_ALARM_ALARMTYPE_DOORBELL_RINGING, VIDEO_INTERCOM_ALARM_ALARMTYPE_DISMISS_INCOMING_CALL, VIDEO_INTERCOM_ALARM_ALARMTYPE_TAMPERING_ALARM, VIDEO_INTERCOM_ALARM_ALARMTYPE_DOOR_NOT_CLOSED, COMM_UPLOAD_VIDEO_INTERCOM_EVENT, NET_DVR_VIDEO_INTERCOM_EVENT, VIDEO_INTERCOM_EVENT_EVENTTYPE_UNLOCK_LOG, VIDEO_INTERCOM_EVENT_EVENTTYPE_ILLEGAL_CARD_SWIPING_EVENT, NET_DVR_UNLOCK_RECORD_INFO
  File "/hcnetsdk.py", line 162, in <module>
    HCNetSDK = cdll.LoadLibrary(hcnetsdk_path)
  File "/usr/local/lib/python3.7/ctypes/__init__.py", line 442, in LoadLibrary
    return self._dlltype(name)
  File "/usr/local/lib/python3.7/ctypes/__init__.py", line 364, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /lib/libhcnetsdk.so: cannot open shared object file: No such file or directory

Have you also copied over the “lib” folder? It’s based on Linux 64bit… if your lib path is different, you can change it on this file… hcnetsdk.py

Just to be sure… So this means I can use the addon even with the home assistant installation (formerly known as hassio)? Is the addon running in a docker container with a seperate linux OS? How can I check if the addon is loaded correctly? I tried to follow your steps and I don´t see any error in the logs but my sensor has only one attirbute (friendly name :slight_smile: )…

There is indeed no log, it the add-on is started, and it stays started, then it should be good …

You should see this below…

you can run the script in an addon or on whatever location, its just a python script… offcourse if you run on another client, point offcourse your rest command to correct IP of HA… i pointed now to localhost…

if you run as add-on and you want to see the logs or try the script, you can enter the docker container with putty… see the other screenshot i posted earlier

Hi Fabio,
Thanks for the reply, Ive since installed the custom firmware from this thread. The KD8003 is on my local LAN. How would i go about setting it up to allow me to open it and get call notifications through Home Assistant on the Local LAN.
I thought id get my head around it but im struggling to understand this one, where is this add on for the SDK and how do i add it? Sorry about this but this is the first obstacle ive hit setting up HA.

SDK is a few post above, the isapi stuff is on thread start

Thanks i tried the SDK but couldnt get it to work.
I tried this below in my config.yaml Im not sure its the best way but it works. The only issue is that the icon on the lovelace after opening the gate it shows as if its permantly open. Is there away to get this to be a momentary switch?

switch:
  - platform: command_line
    switches:
      gatecontrol:
        command_on: curl -i --digest -u admin:password -X PUT  d '<RemoteControlDoor><cmd>open</cmd></RemoteControlDoor>' http://xx.xx.xx.xx/ISAPI/AccessControl/RemoteControl/door/1

What would you recommend the best command for the bell notification be to put in my config.yaml?

See first post, there is an example for the command to get callstatus (if running custom firmware)