ES 6.0: Rules engine for notifications

Discussion topics related to mobile applications for ZoneMinder
User avatar
asker
Posts: 1413
Joined: Sun Mar 01, 2015 12:12 pm

Re: ES 6.0: Rules engine for notifications

Post by asker » Tue Sep 15, 2020 6:01 pm

Some notes:

Code: Select all

CONSOLE DBG-1:2020-09-15,17:32:32 |----> FORK:Shed2 (12), eid:223516 rules: (eid: 223516) Skipping this rule as truck does not pattern match 
<etc>
CONSOLE DBG-1:2020-09-15,17:32:32 |----> FORK:Shed2 (12), eid:223516 rules: (eid: 223516) Found rule for  (12) but no conflicts. Allowing.
This seems correct. Your alarm had an empty cause and you are searching for "truck". That did not match, so it was not muted.
--
My collection of ZoneMinder learnings:
https://wiki.zoneminder.com/Various_ZM_thoughts

Magic919
Posts: 157
Joined: Wed Sep 18, 2013 6:56 am

Re: ES 6.0: Rules engine for notifications

Post by Magic919 » Tue Sep 15, 2020 6:21 pm

That one had a cause of ‘car’ rather than empty. It should also mute, of course.

Magic919
Posts: 157
Joined: Wed Sep 18, 2013 6:56 am

Re: ES 6.0: Rules engine for notifications

Post by Magic919 » Tue Sep 15, 2020 6:25 pm

Having changed to ‘car’ earlier I just had two alerts for detected cars. A quick look at the logs suggests it might be iterating through a few times. I’ll have a better look in the morning and grab you some logs.

Magic919
Posts: 157
Joined: Wed Sep 18, 2013 6:56 am

Re: ES 6.0: Rules engine for notifications

Post by Magic919 » Wed Oct 14, 2020 10:17 am

After a bit of a break and now I've also replaced the ZM server machine, it's working as designed.

On the latest ES build.

I tried to mute for over 23 hours of the day (no cause specified) and that meant it just sent alerts in the remaining 15 minutes of the day - PASS.

I added cause of 'truck' and started to get alerts for 'cars' - PASS.

I changed cause to 'truck' and now 'cars' don't cause alerts. That's a PASS.

Magic919
Posts: 157
Joined: Wed Sep 18, 2013 6:56 am

Re: ES 6.0: Rules engine for notifications

Post by Magic919 » Wed Oct 14, 2020 11:16 am

I may have spoken too soon. Just had an alert for 'car' which is muted.

Code: Select all

/var/log/zm/zmdc.log:CONSOLE DBG-1:2020-10-14,12:04:50 |----> FORK:Shed2 (12), eid:220615 rules: (eid: 220615) -- Processing rule: 1 --
/var/log/zm/zmdc.log:CONSOLE DBG-2:2020-10-14,12:04:50 |----> FORK:Shed2 (12), eid:220615 rules: parsing rule 00:15/23:45 using format:%H:%M
/var/log/zm/zmdc.log:CONSOLE DBG-2:2020-10-14,12:04:50 |----> FORK:Shed2 (12), eid:220615 rules: parsed time from: Thu Jan  1 00:15:00 1970 and to:Thu Jan  1 23:45:00 1970
/var/log/zm/zmdc.log:CONSOLE DBG-2:2020-10-14,12:04:50 |----> FORK:Shed2 (12), eid:220615 rules:(eid: 220615)  seeing if now:Thu Jan  1 12:04:00 1970 is between:Thu Jan  1 00:15:00 1970 and Thu Jan  1 23:45:00 1970
/var/log/zm/zmdc.log:CONSOLE DBG-2:2020-10-14,12:04:50 |----> FORK:Shed2 (12), eid:220615 rules:(eid: 220615)  seeing if now:Wed is part of:
/var/log/zm/zmdc.log:CONSOLE DBG-2:2020-10-14,12:04:50 |----> FORK:Shed2 (12), eid:220615 rules:(eid: 220615)  seeing if cause_has:car is part of Motion: All:
/var/log/zm/zmdc.log:CONSOLE DBG-1:2020-10-14,12:04:50 |----> FORK:Shed2 (12), eid:220615 rules: (eid: 220615) Skipping this rule as car does not pattern match Motion: All
/var/log/zm/zmdc.log:CONSOLE DBG-1:2020-10-14,12:04:50 |----> FORK:Shed2 (12), eid:220615 rules: (eid: 220615) No rules matched
It seems to be looking for 'car' in Motion: All.

Does the [s] have relevance? Usually an [a]

[s] detected:car:88% 000066279:62% Motion: All

User avatar
asker
Posts: 1413
Joined: Sun Mar 01, 2015 12:12 pm

Re: ES 6.0: Rules engine for notifications

Post by asker » Wed Oct 14, 2020 2:02 pm

Your string says the rules engine did not get car. It got only "Motion: All"

Code: Select all

/var/log/zm/zmdc.log:CONSOLE DBG-2:2020-10-14,12:04:50 |----> FORK:Shed2 (12), eid:220615 rules:(eid: 220615)  seeing if cause_has:car is part of Motion: All:
--
My collection of ZoneMinder learnings:
https://wiki.zoneminder.com/Various_ZM_thoughts

Magic919
Posts: 157
Joined: Wed Sep 18, 2013 6:56 am

Re: ES 6.0: Rules engine for notifications

Post by Magic919 » Wed Oct 14, 2020 2:05 pm

Just to add, as the day goes by I'm getting the picture it's inconsistent. Some with cause 'car' do alert, others not. There must be a factor I haven't seen or isolated.

Can see we are both typing here :-)

In the webUI they all look like motion and car. What can I run to check? Can I grab the json? What is ES doing?

Magic919
Posts: 157
Joined: Wed Sep 18, 2013 6:56 am

Re: ES 6.0: Rules engine for notifications

Post by Magic919 » Wed Oct 14, 2020 2:30 pm

I've emailed over the log. Please let me know if I can help further.

Thanks again for your help.

User avatar
asker
Posts: 1413
Joined: Sun Mar 01, 2015 12:12 pm

Re: ES 6.0: Rules engine for notifications

Post by asker » Wed Oct 14, 2020 9:30 pm

Thanks, the logs were useful.
Could you try the latest master please?
--
My collection of ZoneMinder learnings:
https://wiki.zoneminder.com/Various_ZM_thoughts

Magic919
Posts: 157
Joined: Wed Sep 18, 2013 6:56 am

Re: ES 6.0: Rules engine for notifications

Post by Magic919 » Thu Oct 15, 2020 8:48 am

I've installed that and will test.

I've turned on Zm Auth on the new machine and something has broken. ZM and ZMNinja seem happy.

In the logs I see

Code: Select all

10/15/20 06:29:28 zmesdetect_m9[1713884] INF utils.py:130 [Sleeping for 5 seconds before downloading]
10/15/20 06:29:33 zmesdetect_m9[1713884] DBG1 utils.py:173 [Trying to download http://localhost:88/zm/index.php?view=image&eid=220690&fid=alarm&username="admin"&password=*****]
10/15/20 06:29:33 zmesdetect_m9[1713884] DBG1 utils.py:192 [Trying to download http://localhost:88/zm/index.php?view=image&eid=220690&fid=snapshot&username="admin"&password=*****]
10/15/20 06:29:34 zmesdetect_m9[1713884] ERR zm_detect.py:258 [Error reading /var/lib/zmeventnotification/images/220690-alarm.jpg. It either does not exist or is invalid]
10/15/20 06:29:34 zmesdetect_m9[1713884] FAT zm_detect.py:852 [Unrecoverable error:Error reading file /var/lib/zmeventnotification/images/220690-alarm.jpg. It either does not exist or is invalid Traceback:Traceback (most recent call last):
  File "/var/lib/zmeventnotification/bin/zm_detect.py", line 849, in <module>
    main_handler()
  File "/var/lib/zmeventnotification/bin/zm_detect.py", line 261, in main_handler
    raise ValueError(
ValueError: Error reading file /var/lib/zmeventnotification/images/220690-alarm.jpg. It either does not exist or is invalid
]
The JPG is on the FS as expected and www-data owns it, as normal. ZM_USER and ZM_PASSWORD are in secrets file. Notifications started after I disabled Auth, but I can't leave it like that if I want access from outside.

Any idea where I can check? Thanks.

User avatar
asker
Posts: 1413
Joined: Sun Mar 01, 2015 12:12 pm

Re: ES 6.0: Rules engine for notifications

Post by asker » Thu Oct 15, 2020 10:03 am

It seems like the username should be admin and not “admin”. Looks like the file is not being downloaded.
--
My collection of ZoneMinder learnings:
https://wiki.zoneminder.com/Various_ZM_thoughts

Magic919
Posts: 157
Joined: Wed Sep 18, 2013 6:56 am

Re: ES 6.0: Rules engine for notifications

Post by Magic919 » Thu Oct 15, 2020 10:55 am

That's a simple fix. Thanks for the speedy help.

Auth is back on and alerts are being pushed.

I'll get back to testing the es_rules.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests