Question about instant event notifications

Forum for questions and support relating to the 1.30.x releases only.
Locked
jantman
Posts: 14
Joined: Tue May 08, 2018 11:21 am
Location: Atlanta, GA, USA
Contact:

Question about instant event notifications

Post by jantman »

Greetings,

This is my first post, and I've just begun experimenting with ZoneMinder to replace a homegrown system (based on Motion, i.e. "motion-project", and some custom tooling) because it can't deal with all of the moving shadows at my new house.

I've been reading through the forums and Google (as well as the docs) and am sort of confused... am I correct that there's no built-in way to trigger external actions immediately when an event occurs?

At first I thought/read that filters could do it, but that doesn't seem to be the case. I was really confused by the documentation around the "Run in background" option; apparently this seems to be from the web UI's perspective (run the filter on a regular basis instead of when you click the button) as opposed to what I originally thought, the event's perspective (run on a regular basis, instead of every time a new event occurs).

I've found pliablepixels/zmeventserver but I don't really understand why I'd use that; it's still just polling the shared memory on a regular - albeit short - interval.

Am I correct that there's no way to just automatically hook in some external action/command every time an event happens, immediately when the event happens, either built-in or some widely-used "addon" or "plugin"?

Thanks,
Jason
Principal Software Engineer - Some Company
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: Question about instant event notifications

Post by asker »

To the best of my knowledge, there is no plugin today that directly hooks into the C++ code which detects the alarm - that would be as instant as possible.
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
rockedge
Posts: 1173
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA

Re: Question about instant event notifications

Post by rockedge »

look into zmTrigger.pl
this may be fast enough.
jantman
Posts: 14
Joined: Tue May 08, 2018 11:21 am
Location: Atlanta, GA, USA
Contact:

Re: Question about instant event notifications

Post by jantman »

rockedge wrote: Wed Jun 20, 2018 7:34 pm look into zmTrigger.pl
this may be fast enough.
Isn't that the other way around, for triggering alarms?
Principal Software Engineer - Some Company
jantman
Posts: 14
Joined: Tue May 08, 2018 11:21 am
Location: Atlanta, GA, USA
Contact:

Re: Question about instant event notifications

Post by jantman »

asker wrote: Wed Jun 20, 2018 2:18 pm To the best of my knowledge, there is no plugin today that directly hooks into the C++ code which detects the alarm - that would be as instant as possible.
Ok, thanks.

For the time being at least, I think I'm going to look into starting with the code from https://github.com/pliablepixels/zmeventserver (my Perl is **really** rusty, and was never very good to begin with) and replacing the websocket server logic with something that just triggers a command I specify. At least that will get it down to a 5-second-interval polling of the shared memory.
Principal Software Engineer - Some Company
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: Question about instant event notifications

Post by asker »

If that’s all you want to do the event server is overkill. I wrote that for a full alarm system for zmNinja which includes FCM. Take a look at the included zm_alarm file instead. https://github.com/ZoneMinder/zoneminde ... m-alarm.pl
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
jantman
Posts: 14
Joined: Tue May 08, 2018 11:21 am
Location: Atlanta, GA, USA
Contact:

Re: Question about instant event notifications

Post by jantman »

asker wrote: Wed Jun 20, 2018 11:09 pm If that’s all you want to do the event server is overkill. I wrote that for a full alarm system for zmNinja which includes FCM. Take a look at the included zm_alarm file instead. https://github.com/ZoneMinder/zoneminde ... m-alarm.pl
Is the performance of that OK? I'd sort of assumed that querying SQL every second was horribly taxing compared to reading shared memory, and doing it the way you did in the event server...

(I currently have a hacked-up version of zmeventnotification.pl with the WS stuff removed, just making a system call to run another script in the background on every event.)
Principal Software Engineer - Some Company
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: Question about instant event notifications

Post by asker »

Don’t know to be honest. I would assume not. If you’ve already modified the event server then I suppose that’s fine. FWIW I’ll be adding a hook soon to call an external script
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
jantman
Posts: 14
Joined: Tue May 08, 2018 11:21 am
Location: Atlanta, GA, USA
Contact:

Re: Question about instant event notifications

Post by jantman »

Oh cool! I'll keep an eye open for it.
Principal Software Engineer - Some Company
rockedge
Posts: 1173
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA

Re: Question about instant event notifications

Post by rockedge »

Isn't that the other way around, for triggering alarms?
it does ....but zmTrigger.pl also reports the monitor status back....there is a 2 way pipe. I noticed this while experimenting using remote wireless motion detectors that activated recording... and connected via telnet on a 3rd machine that as a camera alarmed I would receive a string indicating an ON state then the OFF state with timestamps
jantman
Posts: 14
Joined: Tue May 08, 2018 11:21 am
Location: Atlanta, GA, USA
Contact:

Re: Question about instant event notifications

Post by jantman »

Ah, ok.
Principal Software Engineer - Some Company
Locked