maciej-or / hikvision_next

Home Assistant integration for Hikvision NVRs and IP cameras
111 stars 21 forks source link

No events #10

Closed kroese closed 1 year ago

kroese commented 1 year ago

Hi,

Two questions:

maciej-or commented 1 year ago

Hi,

Except alarm server and binary sensors this integration provides switches for events detection and switch for holiday mode (perhaps for NVRs only). Having switches you are able to arm cameras for away, at home or other scenarios at single click in HA.

For triggering events you need to have:

If notifications don't work pls share integration logs - described here Reporting issues then I could help more

kroese commented 1 year ago

I have everything that you listed, except for the alarm server since I don't have any alarm system. Also I'm getting the events by email via Hikvision and as notifications in Synology Surveillance Station, so there is no doubt that they are triggered. Just not in Home Assistant.

I enabled debugging and created a log, and combined all lines containing hikvision_next, but it doesn't show any errors or strange messages. You can view it here: https://pastebin.com/raw/siUzSvVw

maciej-or commented 1 year ago

thanks, I've downloaded logs you can delete from pastebin. Alarm server settings are crucial in passing notifications. Camera or NVR send event notifications to defined destination. In this case Home Assistant is the receiver and integration processes HTTP post into binary sensor trigger. You can let hikvision_next integration to set alarm server on camera by checking Set alarm server using following address during adding integration. You can verify that or set it manually in camera's admin panel:

image

IP should point your Home Assistant instance, port is set 8123 by default so update it if you use another one, the rest options should be the same as in the picture

kroese commented 1 year ago

In the README for your integration it said alarmserver was optional, so it didn't sound like it was crucial?

Also it will make things a bit complicated, since my camera is on a seperate network (without internet) compared to my HomeAssistant. Currently I use reverse proxies to tunnel traffic to port 80 and websockets to this camera, but having to open port 8123 in HA will mean I also need to create proxies in the opposite direction. Basicly this will undo some of the security benefits of shielding off the camera in that seperate LAN, if it needs to be able to initiate connections on its own to the rest of my network.

Is there any reason why you needed the alarm server? Because Synology can read these events through ONVIF, and I assume they are also exposed through ISAPI? Because in the official Hikvision integration there was no need for an alarmserver? Just wondering..

maciej-or commented 1 year ago

I meant optional because you can do it manually as well.

To raise security level I'd suggest whitelist HA IP only in camera IP filtering settings. There is no other way to communicate with HA than http, official integration does the same but in reversed direction - it calls ISAPI endpoint in given period, the downside are redundant requests and delays. ONVIF uses HTTP layer as well, unfortunately doesn't cover all acusense events.

Using alarm server notifications are real-time, that was the main motivation to write this integration, it may sound serious but they are only simple HTTP POSTs from camera or NVR to Home Assistant endpoint.

kroese commented 1 year ago

I'm pretty sure that ONVIF covers all events that you currently use in the integration, because they are the same (line detection, intrusion, tampering, etc) as Synology receives.

But I'm really happy to hear that ISAPI are pull events, and not push-events like alarmserver, so now I understand your decision not to use ISAPI.

I was looking for a solution with the least amount of latency/delays, so this sounds much better than the official integration.

I connected the Hikvision to the HA alarmserver now, and all seems to be working great now.