Page 1 of 1

Help with ONVIF Motion Detecion

Posted: Sun May 02, 2021 4:51 am
by nioxic
Hello everyone :D !
I am new to Zoneminder. I managed to install Zoneminder 1.35.27 with Ubuntu 20.04.
I was able to get the camera working by using the ONVIF button and trying to get zoneminder to monitor onvif trigger. However, I am getting an error message as shown below when running zmonfir-trigger.pl

Code: Select all

Caught a SIG at /usr/bin/zmonvif-trigger.pl line 91.main::handler("INT") called at /usr/lib/x86_64-linux-gnu/perl/5.30/IO/Select.pm line 119eval {...} called at /usr/lib/x86_64-linux-gnu/perl/5.30/IO/Select.pm line 119IO::Select::can_read(IO::Select=ARRAY(0x55aaf3ce9910)) called at /usr/bin/zmonvif-trigger.pl line 381main::daemon_main(SOAP::Transport::HTTP::Daemon=HASH(0x55aaf3ce99a0)) called at /usr/bin/zmonvif-trigger.pl line 444main::start_daemon(undef, undef, _ZoneMinder=SCALAR(0x55aaf266ea70)) called at /usr/bin/zmonvif-trigger.pl line 558main::events(undef, undef) called at /usr/bin/zmonvif-trigger.pl line 658 -- shutting down
Can someone help on what should be done in this case?
I would prefer to use camera motion detection just to lower the CPU usage of the system

Re: Help with ONVIF Motion Detecion

Posted: Sun May 02, 2021 6:55 pm
by iconnor
Comment out line 96

Re: Help with ONVIF Motion Detecion

Posted: Sun May 02, 2021 9:32 pm
by nioxic
Thank you! I ended up commenting from line 96 to 100 since it kept getting caught on other error but I can't pinpoint which one.
I can confirm zoneminder is monitoring now but ONVIF message is not getting through which I assumed maybe I put wrong URL for monitoring ONVIF

Re: Help with ONVIF Motion Detecion

Posted: Mon May 03, 2021 6:02 am
by nioxic
Unfortunately I am still not able to get ONVIF going event with this. I know that camera is sending ONVIF message. I tried it using iSpy and managed to get it going.
I am thinking to combine some python script which monitor camera ONVIF and send a separate trigger using zmtrigger.pl since that seems to be an easier work-around.
Is the ONVIF function has been integrated in 1.35 or is this still under testing?

Re: Help with ONVIF Motion Detecion

Posted: Mon May 03, 2021 1:26 pm
by iconnor
I don't actually know if this script works at all. We took a look at it, but were not able to find any cameras that ACTUALLY send onvif events.

Re: Help with ONVIF Motion Detecion

Posted: Mon May 03, 2021 1:31 pm
by nioxic
Yeah, I was not able to get anything so I was thinking that ONVIF trigger might not work.
I'll try to get the camera triggered using some other way somehow.
Thank you for this! Hopefully, the ONVIF feature can be implemented for future release :)

Re: Help with ONVIF Motion Detecion

Posted: Thu Jun 24, 2021 3:24 pm
by nrbell
I don't know if this will be helpful, but I have had some success using the zmonvif-events project. I've used it successfully with my Hikvision doorbell camera to detect motion with the passive IR sensor.

The project needed a couple of changes to work properly with ZoneMinder authentication. It doesn't look like the project is actively being developed, so I didn't bother to submit a PR. I've attached a small patch that shows the changes that I made.

Here is some log output from the program showing it working:

Code: Select all

[monitor 14]: CellMotionDetector: Motion Detected: true
Setting monitor 14 to state true
fetching https://example.org/zm/api/monitors/alarm/id:14/command:on.json?username=zmuser&password=zmpass
[monitor 14]: CellMotionDetector: Motion Detected: false
Setting monitor 14 to state false
fetching https://example.org/zm/api/monitors/alarm/id:14/command:off.json?username=zmuser&password=zmpass
Let me know if you need any additional info.

Re: Help with ONVIF Motion Detecion

Posted: Thu Jun 24, 2021 9:40 pm
by nioxic
That is great news! I will try to give it a shot sometime this weekend and see how it ends up

Re: Help with ONVIF Motion Detecion

Posted: Thu Jun 24, 2021 10:32 pm
by iconnor
If there is a project out there that is useful but looks unmaintained, we can always fork it and bring it under the ZoneMinder project.

Re: Help with ONVIF Motion Detecion

Posted: Thu Jun 24, 2021 10:46 pm
by nrbell
I'm not sure that this project would be all that useful to ZoneMinder since it is written in Node.js.

Re: Help with ONVIF Motion Detecion

Posted: Sat Jul 02, 2022 9:45 pm
by dbcollies
I know this thread is a little old now, but this post was VERY helpful to me. Thanks!

If anyone would be interested, I took nrbell's patch as a starting point, and modified it to support multiple cameras. It uses a YAML config file to specify parameters, so passwords don't show up on the command line. I probably need to do a little cleanup, but it seemed to be workout for me with 4 cameras at once

I had to update the onvif library, so a patch file would probably be fairly large, but I'm happy to share one if interested
nrbell wrote: Thu Jun 24, 2021 3:24 pm I don't know if this will be helpful, but I have had some success using the zmonvif-events project. I've used it successfully with my Hikvision doorbell camera to detect motion with the passive IR sensor.

The project needed a couple of changes to work properly with ZoneMinder authentication. It doesn't look like the project is actively being developed, so I didn't bother to submit a PR. I've attached a small patch that shows the changes that I made.

Here is some log output from the program showing it working:

Code: Select all

[monitor 14]: CellMotionDetector: Motion Detected: true
Setting monitor 14 to state true
fetching https://example.org/zm/api/monitors/alarm/id:14/command:on.json?username=zmuser&password=zmpass
[monitor 14]: CellMotionDetector: Motion Detected: false
Setting monitor 14 to state false
fetching https://example.org/zm/api/monitors/alarm/id:14/command:off.json?username=zmuser&password=zmpass
Let me know if you need any additional info.

Re: Help with ONVIF Motion Detecion

Posted: Tue Jul 05, 2022 2:00 pm
by nicman23
Yes please it would be a great help. Also while it wont be a zoneminder project nothing stops someone to integrate it with proper packaging / container.