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

Yes, will do that laterā€¦
You need fiddler also, to get some header stuff
And also an emulator if you have androidā€¦ Newer android os, doesnā€™t allow to trace https

Hi all,

Some really interesting threads here. I actually just bought a 6113 and simply trying to use a doorbell. No need for a remote unlock/lock function. Really liking homekitā€™s native support surrounding video doorbells and have tried using camera ffmpeg under homebridge. But some limitations as you can probably imagine to that approach. So hopped in the HA and noticed this thread. Were trying to move away from the native HK App as its less than ideal and replicate the doorbell functionality under homekitā€¦e.g. view live video stream (w audio) at anytime, notified on doorbell press, notified on motion detection, and engage in 2-way conversation.

Ive was able to see some of the apisā€¦e.g.

curl -i digest http ://user:[email protected]/ISAPI/VideoIntercom/callStatus
curl -i digest http : // user:[email protected]/ISAPI/VideoIntercom/capabilities

As far as firmware, Iā€™m on V2.2.13 build 201222 and its not proving to have any limitations from an api povā€¦at least right now. I just have no clue right now how to get from here to there. Any general directional suggestions would be greatly welcome!

guys, need some help, i am testing with the Hikconnect integration, i created a login sensor, thats sensor gives me a sessionId like in the appā€¦ With that sessionId we can create other rest commands/sensor like open door, callstatus, callhistory, for example like below

The sessionId offcourse changes, after an amount of time, the below command works, but i cant use it like below, its not allowed to template the headers, its only possible for a value template
any idea how to workaround this? any tips?

if it put it as a static hardcoded string it works offcourse

{{ state_attr('sensor.hikconnect_login', 'loginSession').sessionId }}

  - platform: rest
    name: hikconnect_last_calltime
    scan_interval: 5
    resource: "https://apiieu.hik-connect.com/v3/calling/listByUser?leastTime=&msgStatus=-1&pageSize=1"
    headers:
      #sessionId: "{{ state_attr('sensor.hikconnect_login', 'loginSession').sessionId }}"
      sessionId: eyJhbGciOiJIUzM4NCJ9.eyJhdWQiOixxxxxxxxxxx
    method: GET
    value_template: "Hikvision Last Calltime"
    json_attributes_path: "$.data[0]"    
    json_attributes:
      - callingTime

@mihalich1988 from fiddler , how did you obtain the reauth url? maybe i can use that one

I havenā€™t ever done anything like that. Is it possible to use a template sensor to store the session ID and then use that in the headers??

the problem is that the header doesnt support templating, so we can only use a fixed value or a secret

seems a lot of users have the same issue on this forum, there are maybe some customs out

got it too work, when using a command line sensor, instead of a rest sensor
With a command line, i can use templating :slight_smile:

  - platform: command_line
    command: >
      curl
      --header "sessionId: {{ state_attr('sensor.hikconnect_login', 'loginSession').sessionId }}"
      "https://apiieu.hik-connect.com/v3/devconfig/v1/call/Qxxxxx/status"
    name: hikconnect_callstatus
    scan_interval: 5
    value_template: "Callstatus"
    json_attributes:
      - data

gives me :

so afterwards we can use this template, that gives 1 , 2 , or 3 , regarding call status
{{ (state_attr('sensor.hikconnect_callstatus', 'data')|from_json).callStatus }}

Guys, i edited first post, some Tracing stuff from the HikConnect app, it finally works now for my DS8003 , so now i also have CallStatus, that was not working before with ISAPI :slight_smile:

the only command/state i am trying to find, is the actually state of an door, if relay is open or notā€¦

Guys , can anyone try an ISAPI command? i have 400 or 404 bad request/not found on below ISAPI:

i should give me the state of the input/outputs, for example also the doorlock:
the yellow comamnd, works, but the status , the one with red circle doesnt

I got the same output

Also an ds8003?

Maybe the request is only valid from the indoor panel, gonna try later to read the state from cloudā€¦ Would be usefulll for automationsā€¦

So if i open the door , i can already turn on music and lights :wink:

1 Like

My model: DS-KD8003-IME1 / EU

Model 6113:

ISAPI/System/IO/outputs:

<IOOutputPortList version="2.0" xmlns="http://www.isapi.org/ver20/XMLSchema">
<IOOutputPort version="2.0" xmlns="http://www.isapi.org/ver20/XMLSchema">
<id>1</id>
<name>COM</name>
<IOUseType>electricLock</IOUseType>
</IOOutputPort>
</IOOutputPortList>

/ISAPI/System/IO/outputs/1:

<?xml version="1.0" encoding="UTF-8"?>
<ResponseStatus version="1.0" xmlns="http://www.std-cgi.com/ver10/XMLSchema">
<requestURL>/ISAPI/System/IO/outputs/1</requestURL>
<statusCode>4</statusCode>
<statusString>Invalid Operation</statusString>
<subStatusCode>notSupport</subStatusCode>
<errorCode>1073741825</errorCode>
<errorMsg>The device does not support this resource</errorMsg>
</ResponseStatus>

ISAPI/System/IO/outputs/1/status:

<?xml version="1.0" encoding="UTF-8"?>
<ResponseStatus version="1.0" xmlns="http://www.std-cgi.com/ver10/XMLSchema">
<requestURL>/ISAPI/System/IO/outputs/1/status</requestURL>
<statusCode>4</statusCode>
<statusString>Invalid Operation</statusString>
<subStatusCode>notSupport</subStatusCode>
<errorCode>1073741825</errorCode>
<errorMsg>The device does not support this resource</errorMsg>
</ResponseStatus>

crap, doesnt work also on 61xx device :frowning:

i was hoping to capture the state of a door relay
too bad :frowning:
i am also trying to capture it from the cloud, still no luck
there must be a a way to , i just dont know how :slight_smile: ā€œyetā€

Hi. Sorry for not answering for a long time, vacation.

  • Now the firmware on my device is V2.2.43 build 210407
  • Yes, I have full access to the settings via the web interface.
  • Yes, I poll the device status every second using curl (ubuntu server 20.04).

@pavoroby I think you also have the same device I haveā€¦which API do you poll every second? And can you send my the syntax you use using curl?

curl --digest -u admin:Pa$$w0rd http://10.1.1.245/ISAPI/VideoIntercom/callStatus?format=json

10.1.1.245 ā€“ IP address of my intercom on my local network

do you poll every 1 sec? there is no hammering?
i have the 8003 , that doesnt support that command yet, i am now polling it from cloud from hikconnect , i have it now for testing at 3 sec

Not sure you saw my results for this, but I was polling my 6113 on the local at 0.2 second intervals with success.

@pavoroby thanks for the response. Where did you get your 2.2.43 firmware from, that is very recent. Have you noticed any differences with it? Did you see any release notes for that version?

Further, I assume your device was delivered with an older version of the firmware. Could you confirm, which versions you had to install to get to 2.2.43 with the web UI. I believe you canā€™t just jump from one firmware to another, you have to go through all interim releases, also.

Thanks.