Page 1 of 1

ONVIF_EVENTS_PATH HikVision

Posted: Wed Nov 20, 2024 1:55 am
by atlas
Hello, I am having trouble configuring my camera to trigger zoneminder 1.37.65 using onvif events.
Log says various things depending on what I try ex.
ONVIF Couldn't create subscription! 28, fault:Connection timed out, detail:connect failed in tcp_connect()

Code: Select all

ONVIF Couldn't create subscription! 405, fault:HTTP Error, detail:<!DOCTYPE html><html><head><title>Document Error: Method Not Allowed</title></head><body><h2>Access Error: 405 -- Method Not Allowed</h2><p>Requested method POST not supported for URL: /event_service</p></body></html>
most times the log says nothing regarding onvif events.

ONVIF_URL: http://192.168.46.151:80/onvif/device_service
ONVIF_EVENTS_PATH: /onvif/event_service (tried /Events & /device_service & blank ....)
Username: *****
Password: *****
ONVIF_Options:
ONVIF_Alarm_Text:
SOAP WSA COMPLIANCE: on
ONVIF_Event_Listener: enabled
use_Amcrest_API: enabled

The camera is HikVision DS-2CD2086G2H-I, I have logged into the camera and turned on onvif, set a user with admin rights and turn all the security settings down or off to troubleshoot. Can somebody suggest the proper ONVIF_EVENTS_PATH:

edit:
Well since nobody replied yet, I am thinking this camera does not do onvif events, even though the web interface has a section for onvif, Here is some of the paths detected using some other alternatives to zoneminder:,
http://192.168.46.151/onvif/Media2
http://192.168.46.151:80/onvif/Events
rtsp://192.168.46.151/Streaming/Channels/101?transportmode=unicast&profile=Profile_1
rtsp://192.168.46.151/Streaming/Channels/102?transportmode=unicast&profile=Profile_2
http://192.168.46.151:80/onvif/device_service
http://192.168.46.151:80/onvif-http/snapshot?Profile_1
http://192.168.46.151:80/onvif-http/snapshot?Profile_2


sigh, I was hoping to shed the detection load to the camera itself, I may reinstall tomorrow and start clean again and just go with zoneminder doing the detecting on the low res stream.

Edit#3 Here is a link with all the onvif paths
https://www.onvif.org/member-tools/wp-c ... 16m35s.xml
https://www.onvif.org/conformant-products/

I am guess something is not right with my zoneminder setup?

last edit: Looks like I bought a dud of a camera, Events is covered under onvif profile M, My camera does not have that profile. pfft.
https://www.datavideo.com/article/578/a ... deo-camera
This sucks as I payed a bit for this.
https://www.onvif.org/member-tools/wp-c ... 16m35s.pdf

Re: ONVIF_EVENTS_PATH HikVision

Posted: Wed Nov 20, 2024 5:31 pm
by iconnor
Annoying as even their cheap clones have it enabled.

Re: ONVIF_EVENTS_PATH HikVision

Posted: Wed Nov 27, 2024 10:29 am
by DangerDice
Hi,

I'm new to ZM and am having difficulty setting up my Hikvisions with ONVIF events on a linux box.

I found your post whilst searching how to setup the ONVIF event triggering in ZM v1.37.

Unfortunately I don't have a solution, but I found that a camera does not need to have ONVIF Profile-M support to events.

From what I've read, Profile-S (https://www.onvif.org/profiles/profile-s/) does support "event-handling" and "relay outputs". Whilst Profile-M (https://www.onvif.org/profiles/profile-m/) is for more advanced object detection, i.e. people, vehicles.

ONVIF Profile S Specification v1.3
November 2019
https://www.onvif.org/wp-content/upload ... n_v1-3.pdf

See sections:

7.7 Event Handling

8.13 Relay Outputs (if supported)


Further, Home-Assistant supports "sensors" events (e.g. Motion alarm, relay tirgger, etc) for ONVIF Profile-S devices.
ONVIF Integration
https://www.home-assistant.io/integrations/onvif/

ONVIF
The ONVIF camera integration allows you to use an ONVIF Profile S conformant device in Home Assistant. This requires the ffmpeg integration to be already configured.

...
Supported sensors

This integration uses the ONVIF pullpoint subscription API to process events into sensors that will be automatically added to Home Assistant. Below is a list of currently supported event topics along with the entities they create.
There is hope yet.

I don't pretend to understand ONVIF as ONVIF-tools in the Linux space seems fragmented or lagging compared to the windows/proprietary space. Plus its hard for newbies to grasp what ONVIF can/cannot do or taking advantage of it with FOSS due to the fragmented/lacking documentation. Which is a result of the dominance of proprietary software/systems in the CCTV industry I guess.

For example, I've been looking for a FOSS Linux tool to monitor the ONVIF protocol event information so I can figure out how to setup ZM. However, I've only found the Windows only Device Manager for ONVIF which does support live monitoring of event information.

A promising alternative is OnvifDeviceManager (https://github.com/Quedale/OnvifDeviceManage), but it lacks event monitoring and suggested Home-Assistant (which is where I got the above info).
event queue #32
https://github.com/Quedale/OnvifDeviceManager/issues/32

What you are looking for is actually ONVIF Events (https://www.onvif.org/ver10/events/wsdl/event.wsdl), which isn't implemented yet.
I only implemented bare-bone ONVIF binding at the moment.

...

For your use-case, I would recommend looking into a HomeAssistant server with the ONVIF Integration.
It's a considerable amount of work to setup, but I think it would meet your requirements. (And all free)
It seems like a lot of work to set up Home-Assistant just to see what events the camera is sending.

Is there a guide/tutorial on how to setup ONVIF events to trigger the recording of a (high-res) stream in ZM 1.37?

Does ZM support real-time event monitoring/debugging of ONVIF?

Cheers,
DD

Re: ONVIF_EVENTS_PATH HikVision

Posted: Wed Nov 27, 2024 2:27 pm
by iconnor
ZM 1.37 will use the Pull Point Subscription to pull events. It works with Hikvision, amcrest, reolink, Tapo cameras.

Some Hikvision cameras require you to setup a user with onvif permissions, it can be a bit annoying/difficult to find the option. Others it just works with.

Re: ONVIF_EVENTS_PATH HikVision

Posted: Thu Nov 28, 2024 7:56 am
by DangerDice
Thanks @iconnor for the info.
ZM 1.37 will use the Pull Point Subscription to pull events.
Does this mean it's a planned feature for the future and not yet ready? Is there an ETA for the PPS?

Will it offer real-time viewing of ONVIF event/trigger information?
Some Hikvision cameras require you to setup a user with onvif permissions, it can be a bit annoying/difficult to find the option.
I've created ONVIF user account on the camera with Administration rights which allows me to connect to the camera using the Linux ONVIF Device Manager. So ONVIF does "work", but it's the more complicated stuff that I'm lost with.

I'm just not sure how to use the right magical incantation to listen to events. :D

I guess I'll setup Home-Assistant with the ONVIF module to see if it can detect the ONVIF events.

Could Wireshark help?