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

Hi, this thread is all about the possibility to integrate commands in HA, Local commands, but i also now added commands for Cloud, based on HikConnect APP, see below
Confirmed devices : DS-KV8413, KD8003 and DS-KV8113 KV8213 DS-KV6113

What is working so far …
Video Stream rtsp:

rtsp://user:[email protected]:554/ch1/main/av_stream
rtsp://user:[email protected]:554/Streaming/Channels/101
rtsp://user:[email protected]:554/Streaming/Channels/102
rtsp:/user:[email protected]:554/cam1/h264

ISAPI command : Open a door / Relay

To open an electrical door (relay 1 or 2)
curl -i --digest -u admin:xxx -X PUT -d '<RemoteControlDoor><cmd>open</cmd></RemoteControlDoor>' http://192.168.0.xx/ISAPI/AccessControl/RemoteControl/door/1

ISAPI command : Doorpress event
To capture a doorpress event, (kd8003 stays idle (firmware is coming to fix it)

curl -i --digest -u admin:xxx http://192.168.x.x/ISAPI/VideoIntercom/callStatus?format=json

Should give as output : “idle” , “ring” , “onCall”

"status": "idle"

Based on :

NEW STUFF : HikConnect integration

With Fiddler i made a trace from the HikConnect app, making below sensors possible with easy REST commands… below is confimed working on a DS-KD8003 , maybe the commands are different for other models, so can you guys test so i can maybe add it for other models too?
What i did… I installed Fiddler on my desktop PC for tracing my android. Make sure remote clients is enabled in fidler, also enable htts tracking and install the certificate on android too… Remember, tracing https doesnt work anymore for android 7.0 and newer and also IOS 11 for apple, so i started android on an emulator, i used LDPlayer V3 , thats using android 6.0

ok, when tracing is succesfull, you should see stuf like below screenshot :

based on that i created a Hikconnect login sensor, i am still playing with the scan_interval, i think it needs to be around a day, then the system does a logout , so the sessionid changes, needed for other commands… adapt below header info as seen your fiddler, also the payload is from the “Textview” tab Fiddler, copy pasted that long string

  - platform: rest
    name: hikconnect_login
    scan_interval: 86400
    resource: "https://apiieu.hik-connect.com/v3/users/login/v2"
      customno: #Fiddler header
      appChannel: "hikvision"
      Content-Type: "application/x-www-form-urlencoded"
      featureCode: #Fiddler header
      lang: "en-US"
      clientVersion: #Fiddler header
      appId: "HikConnect"
      sessionId: ""
      clientType: #Fiddler header
      clientNo: #Fiddler header
      areaId: #Fiddler header
      netType: "WIFI"
      osVersion: #Fiddler header
    method: POST
    payload: account= #Fiddler Textview
    value_template: "Hikconnect Login"    
      - loginSession

Restart HA, and test if this is working? Now some fun stuf :slight_smile:
I created a sensor that gives the callhistory, you can change the pageSize from 1 to 15 to get more call history…

  - platform: command_line
    command: >
      --header "sessionId: {% if state_attr('sensor.hikconnect_login', 'loginSession') != None %}{{ state_attr('sensor.hikconnect_login', 'loginSession').sessionId }}{% endif %}"
    name: hikconnect_last_calltime
    scan_interval: 60
    value_template: "Last Calltime"
      - data

The next sensor gives a callstatus, the callstatus changes offcourse when someone actually presses the doorbell or when you pickup … you need to change the serial of your device in the url, i had to use mine from my indoor panel…

  - platform: command_line
    command: >
      --header "sessionId: {% if state_attr('sensor.hikconnect_login', 'loginSession') != None %}{{ state_attr('sensor.hikconnect_login', 'loginSession').sessionId }}{% endif %}"
    name: hikconnect_callstatus
    scan_interval: 5
    value_template: "Call Status"
      - data 

The sjhell command below is to actually open the door, also change serial here

  hikconnect_open_door: >
      curl -X PUT
      --header "sessionId: {{ state_attr('sensor.hikconnect_login', 'loginSession').sessionId }}"

## Variant based on ISAPI Cloud : curl -X POST --header "sessionId: {{ state_attr('sensor.hikconnect_login', 'loginSession').sessionId }}" --data "apiKey=100044&channelNo=1&deviceSerial=QXXXXXX&apiData=PUT /ISAPI/AccessControl/RemoteControl/door/1%0D%0A<RemoteControlDoor><cmd>open</cmd><channelNo>1</channelNo><controlType>monitor</controlType><password></password></RemoteControlDoor>" "https://apiieu.hik-connect.com/v3/userdevices/v1/isapi"   	   	  

The sessionID , i think it expires after about 20-24 hours, so you set the scan interval of the hikconnect login to 10 hours, or use below automation , that checks for example if there is a callhistory, if no callhistory, it means the sensor failed, and it will execute the login sensor again

- alias: Hikconnect Relogin
  initial_state: 'on'
  - platform: state
    entity_id: sensor.hikconnect_last_calltime
  - condition: template
    value_template: >
      {{not state_attr('sensor.hikconnect_last_calltime', 'data') }}
  - service: homeassistant.update_entity
    entity_id: sensor.hikconnect_login

I have this model, at the moment I’ve been able to integrate the camera through the RTSP stream.
Did you buy it eventually? How far have you got with the integration in Home Assistant?

Yeah bought it ,together with indoor…
No integration possible i think, but I have the camera stream in HA.

And on indoor station, i have an relay connected to my ESP board, so when someone presses the doorbell i can work with notifications and also start recording with synology and steam video to google hub…

Also, i was able to setup those stations with a SIP PBX server, it you don’t want to use Hikconnect app…
Because I was unable to find to change a ringtone there… Also if you use Hikconnect, it always activates speaker mode… So there is always an echo for the person outside

I haven’t been able to get the URL for the still image. Have you used the hack explained in the other thread?

Nah , don’t need it, i am using a synology surveillance system, so I have the camera exposed from there…

The use of a SIP server is interesting. What did you install?

I am testing with FreePBX

Alltough, at the end i don’t see any advantage using sip, if you are satisfied with hikconnect app

I’m still in the middle of testing everything.
I had updated the outdoor station to the latest firmware 2.2.3 which was meant to support ONVIF, but HA did not recognize the camera. Did you experience the same?

Didn’t try onvif, rtsp works fine for me

Alright. And in terms of motion detection of the intercom camera, do you have motion events sent to HA from your surveillance system?

No, i disabled motion events, i only record 3 min on a doorpress event… I have other camera outside with motion enabled :slight_smile:

What indoor system have you bought?

I went for 2 DS-KH8350-WTE1 and 2 DS-KH6320-WTE1 indoor stations (it’s a 4 apartments building)

Ah ok, cool

I bought the 9310 model, based on android, to run HA :slight_smile:
But seems the requirements are just too low to run any app, mine will be replaced by a newer model soon

I stayed away from it right because it was not very flexible :slight_smile:
Also, apartments owners just needed an easy to use video intercom system, nothing more.

It’s the same screen, just with with 1 more option that doesn’t work :slight_smile:

How exactly did you hook up to the indoor station to get the doorbell button pressed event?

There is a function in ivms “calling linkage”, then you can define an output relay, that will trigger on a doorpress button

guys, first step into integration, with command below you can open the door from HA :

change offcourse password and ip

curl -i --digest -u admin:xxx -X PUT -d '<RemoteControlDoor><cmd>open</cmd></RemoteControlDoor>' http://192.168.0.xx/ISAPI/AccessControl/RemoteControl/door/1


Great Fabio!
this is working also on DS-KV8113-WME1, with both door locks output!
In my case “door/2” is a gate

it’s months i was looking for something working on this Hikvision series.