tomasbedrich / home-assistant-hikconnect

A Home Assistant integration to communicate with Hikvision smart doorbells via Hik-Connect cloud.
40 stars 9 forks source link

API to send ISAPI commands #20

Closed pergolafabio closed 2 years ago

pergolafabio commented 2 years ago

Hey @tomasbedrich

i have found the command to send ISAPI requests to the intercom, i think it can be verry usefull for you , that way you can get all ISAPI info from the outdoor station!, so you are not limited to info on hikconnect cloud...

2 examples

curl -X POST --header "sessionId: 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"

curl -X POST --header "sessionId: SESSIONID" --data "apiKey=100044&channelNo=1&deviceSerial=QXXXXX&apiData=GET /ISAPI/VideoIntercom/capabilities" "https://apiieu.hik-connect.com/v3/userdevices/v1/isapi"   
pergolafabio commented 2 years ago

These are also usefull maybe, to make extra services in HA? to cancell/answer/hangup a call

https://apiieu.hik-connect.com/v3/devconfig/v1/call/QXXX/operation?cmdId=3&handler=e6ldym

use cmdId=3 or 2 or 5

tomasbedrich commented 2 years ago

Hey @pergolafabio, for the request above I'm getting this response:

{
    "meta": {
        "code": 2009,
        "message": "设备网络异常,请检查设备网络或者重试",
        "moreInfo": null
    }
}

I guess that's because my intercom doesn't support ISAPI at all.

It would be valuable to know how many people using this integration own devices supporting cloud-ISAPI to accordingly prioritize this issue. Currently, I don't have a clue.

pergolafabio commented 2 years ago

what intercom do you have?

tomasbedrich commented 2 years ago

https://github.com/tomasbedrich/home-assistant-hikconnect/blob/main/COMPATIBILITY.md?plain=1#L3

tomasbedrich commented 2 years ago

Thanks to your suggestions, I have been able to construct generic ISAPI proxy layer over Hik-Connect cloud. :) You can expect some more development in that way in next versions... I don't know where are you getting your tips from. :)

tjunussov commented 3 months ago

nstruct generic ISAPI proxy layer

I have same error "code": 2009, "message": "设备网络异常,请检查设备网络或者重试", however I could call http://{localip}/ISAPI/VideoIntercom/capabilities

what wrong i making ? i noticed what you use deviceSerial=QXXXXX where Q is prefix to SerialNumber ? i tried with Q and without nothing helped

maybe i should provide correct APIKEY=100044? but where I could obtain it ?