the timer isnt working

Discussion topics related to mobile applications and ZoneMinder Event Server (including machine learning)
Post Reply
aarons6
Posts: 49
Joined: Mon Feb 08, 2016 12:13 pm

the timer isnt working

Post by aarons6 »

i have it set to not send an event if its been less than 300 seconds.. yet it ignores that and just keeps sending events back to back.

it has to be something in this part that is broken.
my tokens.txt has the correct numbers
"intlist":"300,300,300,300,300,300,300,300,300,300"
the debug doesnt mention the should send out message.. so its failing at the first if and just ignoring everything.

Code: Select all

if ( isInList( $monlist, $alarm->{MonitorId} ) ) {
    my $mint = getInterval( $intlist, $monlist, $alarm->{MonitorId} );
    if ( $last_sent->{ $alarm->{MonitorId} } ) {
      my $elapsed = time() - $last_sent->{ $alarm->{MonitorId} };
      if ( $elapsed >= $mint ) {
        Debug(1, 'Monitor ' . $alarm->{MonitorId} . " event: should send out as  $elapsed is >= interval of $mint");
        $retVal = 1;
      } else {
        Debug(1, 'Monitor ' . $alarm->{MonitorId} . " event: should NOT send this out as $elapsed is less than interval of $mint");
        $retVal = 0;
      }
    } else {
      # This means we have no record of sending any event to this monitor
      #$last_sent->{$_->{MonitorId}} = time();
      Debug(1, 'Monitor '.$alarm->{MonitorId}.' event: last time not found, so should send');
      $retVal = 1;
    }
  } else {
    # monitorId not in list
    Debug(1, 'should NOT send alarm as Monitor '.$alarm->{MonitorId}.' is excluded');
    $retVal = 0;
  }

  return $retVal;
}
User avatar
iconnor
Posts: 3387
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: the timer isnt working

Post by iconnor »

Well, uncomment the debug line at 2874 and let's see what isInList thinks.

This managing lists as strings etc is really inefficient. Could really be a lot better.But it's fast enough I guess.
aarons6
Posts: 49
Joined: Mon Feb 08, 2016 12:13 pm

Re: the timer isnt working

Post by aarons6 »

ok ill try that.
this is what that debug says.
[REMOVE: looking for 5 inside 1,2,3,4,5,7,6,8,9,10]

ok im getting this
Use of uninitialized value $mint in numeric ge (>=) at /usr/bin/zmeventnotification.pl line 3213.
Use of uninitialized value $mint in concatenation (.) or string at /usr/bin/zmeventnotification.pl line 3214.

and the log shows this

[Monitor 9 event: should send out as 10.0326900482178 is >= interval of ]


so the timer isnt working because it doesnt know the value of $mint.

Code: Select all

    my $mint = getInterval( $intlist, $monlist, $alarm->{MonitorId} );
from line 3210
im guessing its supposed to get those from the tokens.txt file.

also im getting a bunch of this

Use of uninitialized value in string eq at /usr/bin/zmeventnotification.pl line 3596.
Use of uninitialized value in string eq at /usr/bin/zmeventnotification.pl line 3675.
Use of uninitialized value in string eq at /usr/bin/zmeventnotification.pl line 3457.
Use of uninitialized value in string eq at /usr/bin/zmeventnotification.pl line 3596.
Use of uninitialized value in string eq at /usr/bin/zmeventnotification.pl line 3675.
Use of uninitialized value in string eq at /usr/bin/zmeventnotification.pl line 3457.

not sure if that has anything to do with it. altho this might be because one of my cameras is down and has poor connection?

the code reads this

Code: Select all

    } elsif ( $alarm->{End}->{State} eq 'ready' ) {

      my ( $rulesAllowed, $rulesObject ) = isAllowedInRules($alarm);
Post Reply