Help with ONVIF Motion Detecion

Previous development branch now released as 1.36
Locked
nioxic
Posts: 5
Joined: Sun May 02, 2021 4:46 am

Help with ONVIF Motion Detecion

Post 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
User avatar
iconnor
Posts: 2862
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Help with ONVIF Motion Detecion

Post by iconnor »

Comment out line 96
nioxic
Posts: 5
Joined: Sun May 02, 2021 4:46 am

Re: Help with ONVIF Motion Detecion

Post 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
nioxic
Posts: 5
Joined: Sun May 02, 2021 4:46 am

Re: Help with ONVIF Motion Detecion

Post 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?
User avatar
iconnor
Posts: 2862
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Help with ONVIF Motion Detecion

Post 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.
nioxic
Posts: 5
Joined: Sun May 02, 2021 4:46 am

Re: Help with ONVIF Motion Detecion

Post 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 :)
nrbell
Posts: 30
Joined: Mon Jun 04, 2018 1:14 pm

Re: Help with ONVIF Motion Detecion

Post 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.
Attachments
zmonvif-events-zmcred.patch.txt
(2.07 KiB) Downloaded 277 times
nioxic
Posts: 5
Joined: Sun May 02, 2021 4:46 am

Re: Help with ONVIF Motion Detecion

Post by nioxic »

That is great news! I will try to give it a shot sometime this weekend and see how it ends up
User avatar
iconnor
Posts: 2862
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Help with ONVIF Motion Detecion

Post 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.
nrbell
Posts: 30
Joined: Mon Jun 04, 2018 1:14 pm

Re: Help with ONVIF Motion Detecion

Post by nrbell »

I'm not sure that this project would be all that useful to ZoneMinder since it is written in Node.js.
dbcollies
Posts: 1
Joined: Sat Jul 02, 2022 9:34 pm

Re: Help with ONVIF Motion Detecion

Post 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.
nicman23
Posts: 1
Joined: Tue Jul 05, 2022 1:59 pm

Re: Help with ONVIF Motion Detecion

Post 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.
Locked