Page 1 of 1

Question about instant event notifications

Posted: Tue Jun 19, 2018 10:12 am
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

Re: Question about instant event notifications

Posted: Wed Jun 20, 2018 2:18 pm
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.

Re: Question about instant event notifications

Posted: Wed Jun 20, 2018 7:34 pm
by rockedge
look into zmTrigger.pl
this may be fast enough.

Re: Question about instant event notifications

Posted: Wed Jun 20, 2018 8:28 pm
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?

Re: Question about instant event notifications

Posted: Wed Jun 20, 2018 8:30 pm
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.

Re: Question about instant event notifications

Posted: Wed Jun 20, 2018 11:09 pm
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

Re: Question about instant event notifications

Posted: Wed Jun 20, 2018 11:34 pm
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.)

Re: Question about instant event notifications

Posted: Thu Jun 21, 2018 12:21 am
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

Re: Question about instant event notifications

Posted: Thu Jun 21, 2018 12:41 am
by jantman
Oh cool! I'll keep an eye open for it.

Re: Question about instant event notifications

Posted: Thu Jun 21, 2018 8:27 pm
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

Re: Question about instant event notifications

Posted: Thu Jun 21, 2018 8:33 pm
by jantman
Ah, ok.