Skip to content

Hik-Connect for Teams (HikCentral Connect) OpenAPI #282

Description

@pergolafabio

What happened?

Hi, seems devices with newer firmware are not supporting callstate events, and maybe more stuff is broken, my guess Hikvision is switching to OpenAPI
You can find document with all API reference here:
https://www.scribd.com/document/909409593/Hik-Connect-for-Teams-OpenAPI-Developer-Guide-V2-13-0-20250516-1

You can easily integrate it, i have added an example below.
FIRST: contact Hikvision, you need to an appKey and secretKey, its a free service by Hikvision, with those keys, you can create a token...
you can switch to teammode here:
https://www.hik-connect.com/views/login/index.html#/portal

You can test with curl commands, i use postman: https://web.postman.co/
Afterwards , you can integrate it in HA, first of all create a command line sensor to grab the token... (appkey and secretkey you need to obtain by hikvision support)

- sensor:
    name: Hik_ConnectToken
    unique_id: hik_connecttoken
    command: >
        curl --location 'https://ieu.hikcentralconnect.com/api/hccgw/platform/v1/token/get' --header 'Content-Type: application/json' --data '{"appKey":"XXXXX","secretKey":"XXXXX"}'
    scan_interval: 1440
    value_template: "{{ value_json.data.accessToken }}"
    json_attributes_path: "$.data"
    json_attributes:
    - accessToken
    - expireTime
    - userId
    - areaDomain

Once the token is created, you can use it to make another sensor, like callstate, camera, ... below is an example to get device details by serialnumber... you see i use the token from the first sensor...
In the document is also explained how to subscribe to messages, you can use a restfull command or shellcommand for that, and then create again a sensor for events...

- sensor:
    name: Hik_ConnectDevice
    unique_id: hik_connectevice
    command: >
        curl --location 'https://ieu.hikcentralconnect.com/api/hccgw/resource/v1/devicedetail/get' --header 'Token: {{ state_attr("sensor.hik_connecttoken", "accessToken") }}' --header 'Content-Type: application/json' --data '{"deviceSerialNo":"XXXXXXX"}'
    scan_interval: 10
    value_template: "{{ value_json.data.device.baseInfo.name }}"
    json_attributes_path: "$.data.device.baseInfo"
    json_attributes:
    - id
    - name
    - serialNo
    - version
    - type

Above 2 sensors, should give this as a state:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions