judge / homebridge-hikconnect

A Homebridge plugin to communicate with Hikvision smart doorbells via Hik-Connect cloud and allows lock to be unlocked. It exposes doorbell locks as a lock accessories to Homekit.
MIT License
18 stars 2 forks source link

Call doorbell on local network instead going through the hikconnect cloud #4

Closed bydga closed 2 years ago

bydga commented 2 years ago

Hi,

thanks for the great module, I recently bought a Hikvision doorbell and integrating the buzzer into HK is a great possibility for me (i can remove the shelly that has been proxying the relay signal from doorbell to the outside-gate 🙂 )

However i just discovered you are calling the remote hikvision api to control the doorbell relay. And I found a command that can be used to do the same action - but via local network 🙂 (btw my outdoor station is DS-KV6113-WPE1)

 curl -i --digest -u admin:pass -X PUT -d '<RemoteControlDoor><cmd>open</cmd></RemoteControlDoor>' http://192.168.0.117/ISAPI/AccessControl/RemoteControl/door/1
HTTP/1.1 401 Unauthorized
Date: Wed, 01 Dec 2021 23:57:40 GMT
Server: webs
Content-Length: 235
Connection: close
X-Frame-Options: SAMEORIGIN
Cache-Control: no-store
Pragma: no-cache
WWW-Authenticate: Digest qop="auth", realm="DS-25EA0C7A", nonce="xxxx=", stale="false", opaque="", domain="::"
Content-Type: application/xml

HTTP/1.1 200 OK
Date: Wed, 01 Dec 2021 23:57:40 GMT
Server: webs
Content-Length: 295
Connection: close
X-Frame-Options: SAMEORIGIN
Cache-Control: no-store
Pragma: no-cache
Content-Type: application/xml

<?xml version="1.0" encoding="UTF-8"?>
<ResponseStatus version="1.0" xmlns="http://www.std-cgi.com/ver10/XMLSchema">
<requestURL>/ISAPI/AccessControl/RemoteControl/door/1</requestURL>
<statusCode>1</statusCode>
<statusString>OK</statusString>
<subStatusCode>ok</subStatusCode>
</ResponseStatus>

My idea of a smarthome is not to be dependent on an internet connection - without internet, remote control is obviously lost, but when you are at home, everything should work as usual.

So this is more like a feature idea/proposal, how to make your module better. PLus i've read in another issue that you are calling some undocumented reverse-engineered api - so they can change it anytime and this module will break :/

I haven't developed anything for HB yet, but if i find some time, i will try to help and send you a PR 🙂

judge commented 2 years ago

Hi @bydga !

Thanks for the idea. The thing is that I cannot access the admin panel of my intercom so I cannot enable the ISAPI interface what you mentioned (I'm not the owner of the intercom, I live in a block with many flats). So using the ISAPI interface is not possible for me (and many others same situation as me) that's why I implemented this through hik-connect with an unofficial API.

If I would have access I would create a new plugin without the relying the cloud and using the official API, but this plugin is intended for folks like me who cannot access ISAPI for some reason.

bydga commented 2 years ago

Ah, ok. got it 🙂 Funny how eveyone has completely different needs/use cases for just a doorbell :D So i will probably end up writing my own module. But till then, i will surely be using yours, thanks!