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

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)

Hi again,

I have the DS-KV8413-WME1(B) and trying to see if possible to distinguish which doorbell has been pressed so I can send an alert to a specific dwelling. Then will use Hikconnect app to answer, etc, but just want to alert the specific dwelling so that not everyone gets alerted for every doorbell press.

Trying to get an interim solution together while I wait for the new Indoor Station to come out later this year.

Thanks.

1 Like

I tried that before, you want to open hilconnet manually to accept the call? I don’t think that works… You need to enable notifications too in hikconnect, that’s the only way to accept calls…

A better road is to setup an SIP server instead and use soft phone clients…

There is a work in progress for HA, it’s a sip add-on and a Lovelace card… It’s now in alpha stage…

Hi all, been looking at doorbells.
Wanted To ask about the kv6113 in standalone mode.

If I used the iVMS-4500 iOS app. Can I accept the call? From the doorbell button press?

I’m wanting to have the kv6113 fully disconnected from internet. Was hoping to still get 2 way audio working via vpn.

I don’t want to use hik connect which relies on the doorbell having internet. I want to be able to have the doorbell notification enter HASS then I vpn back in to somehow answer the call? Will this be possible?

Why nog use your own SIP?

Does it work well? Video and all?

As I won’t be connected to vpn all the time I would need some kind of notification to alert me I need to answer a call.
I guess I can notify myself when a SIP call comes in.

Can you still open the door lock via SIP call?