pergolafabio / Hikvision-Addons

Home Assistant: Hikvision Doorbell
171 stars 36 forks source link

Status not changed when the 'Exit' button is used #107

Closed zefir-o closed 1 year ago

zefir-o commented 1 year ago

What happened?

Thank you for the great work! I am using a Docker image and it is working well. I can confirm that the Home Assistant app is able to display the status of a call and the lock state. Whenever I open the door using a Mifare or the app, the status gets updated accordingly. However, if I open the door using an external ‘Exit’ button located within the perimeter, the doorbell indicates that ‘The door is opened’, but the status in Home Assistant does not change. Is there a bug that needs to be fixed?

Add-on

Hikvision Doorbell

What version of the add-on are you running?

image: ghcr.io/pergolafabio/hikvision-doorbell:3.0.0-beta.16

Installation type

Docker container (standalone)

Relevant log output

No status changes when the 'Exit' button is used.

Relevant configuration

KV6113 + external 'Exit' button.
docker HA, MQTT moquitto

Anything else?

No response

pergolafabio commented 1 year ago

that possibly another type of event , do you see something in the log when you open the door with the exit button? It’s probably classified as an alarm I/O event… You can also build automations based on this type of event

zefir-o commented 1 year ago

hi @pergolafabio I used the following log levels SYSTEM__LOG_LEVEL=DEBUG SYSTEM__SDK_LOG_LEVEL=DEBUG and there is no any event in logs when I press an Exit button. I copy paste the log. Between 2 open events (triggered from the app) I pressed the exit button 3 times. docker-hikvision-1 | 2023-05-01 13:06:38.973 | INFO | event:video_intercom_event:98 - Video intercom event from doorbell docker-hikvision-1 | 2023-05-01 13:06:38.974 | INFO | mqtt:video_intercom_event:199 - Door 1 unlocked by **, updating sensor Door 1 relay docker-hikvision-1 | [2023-05-01 13:06:38.971][INF] Alarm[0] IP[192.168.] data_len[29303] alarm_len[29303] status[431] docker-hikvision-1 | [2023-05-01 13:06:57.111][DBG] Alarm chan [0] recv timeout[2]! docker-hikvision-1 | [2023-05-01 13:07:22.145][DBG] Alarm chan [0] recv timeout[2]! docker-hikvision-1 | [2023-05-01 13:07:52.184][DBG] Alarm chan [0] recv timeout[2]! docker-hikvision-1 | [2023-05-01 13:08:06.828][INF] Alarm[0] IP[192.168.] data_len[29002] alarm_len[29002] status[431] docker-hikvision-1 | 2023-05-01 13:08:06.829 | DEBUG | event:_handle_callback:192 - Callback invoked from SDK docker-hikvision-1 | 2023-05-01 13:08:06.830 | DEBUG | event:_invoke_handlers:166 - Invoking 2 handlers docker-hikvision-1 | 2023-05-01 13:08:06.831 | INFO | event:video_intercom_event:98 - Video intercom event from doorbell docker-hikvision-1 | 2023-05-01 13:08:06.832 | INFO | mqtt:video_intercom_event:199 - Door 1 unlocked by ***, updating sensor Door 1 relay

pergolafabio commented 1 year ago

The exit button is new to me, can you tell me more about it? Is it hooked up on the alarm input or output? Is it connected to indoor or outdoor?

zefir-o commented 1 year ago

As far as I remember it has the following wiring, as it is described in the manual on this page https://www.manualslib.com/manual/2946426/Hikvision-Ds-Kv6113-Pe1.html?page=15#manual

pergolafabio commented 1 year ago

Yeah, I already looked in SDK, but for some reason, alarm input events are not visible in SDK debug, not sure why

zefir-o commented 1 year ago

I hope/think this event should help: EVENT_ACS_DOOR_BUTTON_PRESS https://tpp.hikvision.com/Wiki/ISAPI/Access%20Control%20on%20Person/GUID-3DA08C41-78D4-41C4-A22C-5B0B57D23C15.html

pergolafabio commented 1 year ago

Yeah but I think those events are for ACS controllers, not door intercoms

zefir-o commented 1 year ago

Is there any way to query for all event types supported by device via ISAPI?

pergolafabio commented 1 year ago

Hmm, not sure, I stepped away from Isapi for event stream, since it was not compatible for all devices and a real struggle...

But I have another look next week with the ACS

zefir-o commented 1 year ago

Ok. Let me know if I can assist somehow. It will be really cool to make this fully functioning and get notifications about door opening via an exit button.

pergolafabio commented 1 year ago

Perfect, thnx in advance

pergolafabio commented 1 year ago

had a look, but i dont think its possible

this addon listens for these events:

https://open.hikvision.com/hardware/definitions/NET_DVR_StartListen_V30.html

When there is somekind of event, we trigger this, for example:

COMM_UPLOAD_VIDEO_INTERCOM_EVENT or COMM_ALARM_VIDEO_INTERCOM ...

we are also listening for :

COMM_ALARM_ACS : https://open.hikvision.com/hardware/structures/NET_DVR_ACS_ALARM_INFO.html

those are the events you want, like exit button ... but its not triggered by the device My guess this only works with an Hikvision ACS controller , dont think a standalone Intercom can create those events Or Maybe these events need to be enabled somehow on the intercom itself with ivms, like with motion detection, if not enabled, we dont see it as an event

pergolafabio commented 1 year ago

gonna close for now, since i dont think we can grab this event

zefir-o commented 1 year ago

Hi, FYI I just got a reply from a support team. They confirmed, that KV6113 doesn't support eventing on exit button press.

Dear Client I did the test, I got the same results as yours, and I checked with the R&D team, the device does not upload door open/lock events when you use the exit button. If you think it is necessary, please check with our local pre-sale team, and discuass abount the customization request,

pergolafabio commented 1 year ago

That's too bad indeed :-(