Why is ZMES skipping Events !Solved!

Discussion topics related to mobile applications and ZoneMinder Event Server (including machine learning)
lucas_nz
Posts: 2
Joined: Wed Sep 15, 2021 7:36 pm

Re: Why is ZMES skipping Events !Solved!

Post by lucas_nz »

I'm not sure if it's a good idea to reopen this thread. I've noticed short events are sometimes missed on my zmes set up. This (https://zmeventnotification.readthedocs ... ered-in-zm) section suggests extending the post event buffer. Mine is set to 100 @4fps, that's 25 seconds, so should easily be caught. BUT (after adding some additional logging to zmeventnotification.log, I've noticed these short events go to state 4 ( = STATE_TAPE ??? ).

Having a play around, it seems that if I put the monitor into Record or Mocord, then the monitor is in state 5.

The plot thickens, it seems the state constants in perl don't match zoneminder:
https://github.com/ZoneMinder/zoneminde ... mory.pm.in

Code: Select all

use constant STATE_UNKNOWN  => 0;
use constant STATE_IDLE     => 1;
use constant STATE_PREALARM => 2;
use constant STATE_ALARM    => 3;
use constant STATE_ALERT    => 4;
use constant STATE_TAPE     => 5;

Code: Select all

cat test.pl
#!/usr/bin/perl  -T

use ZoneMinder;

print "STATE_UNKNOWN " . STATE_UNKNOWN . "\n";
print "STATE_IDLE " . STATE_IDLE . "\n";
print "STATE_PREALARM " . STATE_PREALARM . "\n";
print "STATE_ALARM " . STATE_ALARM . "\n";
print "STATE_ALERT " . STATE_ALERT . "\n";
print "STATE_TAPE " . STATE_TAPE . "\n";

Code: Select all

./test.pl
STATE_UNKNOWN STATE_UNKNOWN
STATE_IDLE 0
STATE_PREALARM 1
STATE_ALARM 2
STATE_ALERT 3
STATE_TAPE 4
It seems there is a bug with the constants in perl - does that means this is a zoneminder bug rather than zmes? For now I've changed line 1406 of zmeventnotification.pl to:

Code: Select all

    if ($state == STATE_ALARM || $state == STATE_ALERT || $state == 4) {
User avatar
iconnor
Posts: 2881
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Why is ZMES skipping Events !Solved!

Post by iconnor »

This is kindof a big problem. Used to be that STATE_UNKNOWN was -1. This is a problem, because I wanted to use the value to index into an array of strings to print out the state. So Unknown became 0. The problem is I did this in the middle of a stable series. Bad me.

So in 1.36.26, in terms of the API, we now hack the value back to where it should be by subtracting -1.

In perl land... yeah we never defined STATE_UNKNOWN and the values are wrong. I will fix this in 1.36.27 which should be released maybe tomorrow or monday.
User avatar
iconnor
Posts: 2881
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Why is ZMES skipping Events !Solved!

Post by iconnor »

If anyone would like to try out the fix early, please use the proposed ppa. You should get something reporting as 1.36.27.
lucas_nz
Posts: 2
Joined: Wed Sep 15, 2021 7:36 pm

Re: Why is ZMES skipping Events !Solved!

Post by lucas_nz »

I've upgraded and done some simple checks. Seems to be working correctly again :)
Post Reply