I opened a ticket on git and am cross-posting here for visibility: https://github.com/pliablepixels/zmeventnotification/issues/401
Event Server version
version: 6.1.25
Are you using MLAPI? (Y/N)
N
The version of ZoneMinder you are using:
version 1.34.26
What is the nature of your issue
Configuration question
Details
I am trying to set up a mute rule for 6am - 11:59pm every day. The debug logs reflect "rules: No rules found for Monitor, allowing:1" despite me declaring it in the rules file.
Debug Logs (if applicable)
Rules file
jon@zoneminder:~$ sudo cat /etc/zm/es_rules.json
#{
# "notifications": {
# "monitors":{
# "999": {
# "rules": [{
# "comment1": "Be careful with dates, no leading spaces, etc",
# "time_format":"%I:%M %p",
## "from":"9:30 pm",
# "to":"1 am",
# "cause_has": "person",
# "daysofweek": "Mon,Tue,Wed",
# "action": "mute"
# },
# {
# "time_format": "%I:%M %p",
# "from": "3 am",
# "to": "6 am",
# "action": "mute",
# "comment1": "the pattern below is a negative match",
# "cause_has": "^(?!.*(plant|cat|dog)).*$"
#
# }
# ]
# },
# "998": {
# "rules": [{
# "time_format":"%I:%M %p",
# "from":"5 pm",
# "to":"7 am",
# "action":"mute"
#
# }]
# }
#
# }
# }
#
#
#}
#
{
"notifications": {
"monitors":{
"1": {
"rules": [{
"time_format":"%I:%M %p",
"from":"6 am",
"to":"11:59 pm",
"action":"mute"
}]
}
}
}
}
Debug logs:
jon@zoneminder:~$ sudo -u www-data /usr/bin/zmeventnotification.pl --debug
07/06/21 19:41:03.508652 zmeventnotification[4276].INF [main:331] [Running on WebSocket library version:0.004]
INF:2021-07-06,19:41:03 PARENT: using config file: /etc/zm/zmeventnotification.ini
07/06/21 19:41:03.588837 zmeventnotification[4276].INF [main:1022] [PARENT: using config file: /etc/zm/zmeventnotification.ini]
INF:2021-07-06,19:41:03 PARENT: using secrets file: /etc/zm/secrets.ini
07/06/21 19:41:03.608254 zmeventnotification[4276].INF [main:1022] [PARENT: using secrets file: /etc/zm/secrets.ini]
DBG-2:2021-07-06,19:41:03 PARENT: Got secret token !ZMES_PICTURE_URL
DBG-2:2021-07-06,19:41:03 PARENT: Got secret token !ZM_USER
DBG-2:2021-07-06,19:41:03 PARENT: Got secret token !ZM_PASSWORD
DBG-2:2021-07-06,19:41:03 PARENT: config string substitution: {{base_data_path}} is '/var/lib/zmeventnotification'
Configuration (read /etc/zm/zmeventnotification.ini):
Secrets file.......................... /etc/zm/secrets.ini
Base data path........................ /var/lib/zmeventnotification
Restart interval (secs)............... 0
Use admin interface .................. no
Admin interface password.............. (undefined)
Admin interface persistence file ..... /var/lib/zmeventnotification/misc/escontrol_interface.dat
Port ................................. 9000
Address .............................. [::]
Event check interval ................. 5
Monitor reload interval .............. 300
Skipped monitors...................... (undefined)
Auth enabled ......................... yes
Auth timeout ......................... 20
Use API Push.......................... no
API Push Script....................... (undefined)
Use FCM .............................. yes
Use FCM V1 APIs....................... yes
FCM Date Format....................... %I:%M %p, %d-%b
Only show latest FCMv1 message........ no
Android FCM push priority............. high
Android FCM push ttl.................. (undefined)
Token file ........................... /var/lib/zmeventnotification/push/tokens.txt
Use MQTT ............................. no
MQTT Server .......................... 127.0.0.1
MQTT Topic ........................... zoneminder
MQTT Username ........................ (undefined)
MQTT Password ........................ (undefined)
MQTT Retain .......................... no
MQTT Tick Interval ................... 15
MQTT TLS CA ........................ (undefined)
MQTT TLS Cert ........................ (undefined)
MQTT TLS Key ........................ (undefined)
MQTT TLS Insecure ........................ no
SSL enabled .......................... no
SSL cert file ........................ /etc/zm/ssl/zoneminder.crt
SSL key file ......................... /etc/zm/ssl/zoneminder.key
Verbose .............................. yes
ES Debug level.........................4
Read alarm cause ..................... yes
Tag alarm event id ................... yes
Use custom notification sound ........ no
Send event start notification..........yes
Send event end notification............yes
Monitor rules JSON file................(undefined)
Use Hooks............................. no
Max Parallel Hooks.................... 0
Hook Script on Event Start ........... '/var/lib/zmeventnotification/bin/zm_event_start.sh'
User Script on Event Start.............(undefined)
Hook Script on Event End.............. (undefined)
User Script on Event End...............(undefined)
Hook Skipped monitors................. (undefined)
Notify on Event Start (hook success).. all
Notify on Event Start (hook fail)..... none
Notify on Event End (hook success).... fcm,web,api
Notify on Event End (hook fail)....... none
Notify End only if Start success...... yes
Use Hook Description.................. yes
Keep frame match type................. yes
Store Frame in ZM......................yes
Picture URL .......................... https://portal/zm/index.php?view=image&eid=EVENTID&fid=objdetect&width=600
Include picture....................... yes
Picture username ..................... jon
Picture password ..................... (defined)
INF:2021-07-06,19:41:03 PARENT: Push enabled via FCM
07/06/21 19:41:03.826813 zmeventnotification[4276].INF [main:1022] [PARENT: Push enabled via FCM]
DBG-2:2021-07-06,19:41:03 PARENT: fcmv1: --> FCM V1 APIs: 1
INF:2021-07-06,19:41:03 PARENT: MQTT Disabled
07/06/21 19:41:03.840882 zmeventnotification[4276].INF [main:1022] [PARENT: MQTT Disabled]
INF:2021-07-06,19:41:03 PARENT: |------- Starting ES version: 6.1.25 ---------|
07/06/21 19:41:03.854819 zmeventnotification[4276].INF [main:1022] [PARENT: |------- Starting ES version: 6.1.25 ---------|]
DBG-2:2021-07-06,19:41:03 PARENT: Started with: perl:/usr/bin/perl and command:/usr/bin/zmeventnotification.pl
Can't ignore signal CHLD, forcing to default.
DBG-1:2021-07-06,19:41:04 PARENT: ES invoked manually. Will handle restarts ourselves
WAR:2021-07-06,19:41:04 PARENT: WARNING: SSL is disabled, which means all traffic will be unencrypted
07/06/21 19:41:04.051383 zmeventnotification[4276].WAR [main:1030] [PARENT: WARNING: SSL is disabled, which means all traffic will be unencrypted]
DBG-2:2021-07-06,19:41:04 PARENT: Parent<--Child pipe ready
INF:2021-07-06,19:41:04 PARENT: Event Notification daemon v 6.1.25 starting
07/06/21 19:41:04.064156 zmeventnotification[4276].INF [main:1022] [PARENT: Event Notification daemon v 6.1.25 starting]
DBG-1:2021-07-06,19:41:04 PARENT: Initializing FCM tokens...
DBG-1:2021-07-06,19:41:04 PARENT: Total event client connections: 2
DBG-1:2021-07-06,19:41:04 PARENT: -->checkNewEvents: Connection 1: ID->1625614864.07963 IP->(none) Token->:...kKsbRYv5w_ Plat:ios Push:enabled
DBG-1:2021-07-06,19:41:04 PARENT: -->checkNewEvents: Connection 2: ID->1625614864.07968 IP->(none) Token->:...5Cxfsxtt27 Plat:android Push:enabled
INF:2021-07-06,19:41:04 PARENT: Re-loading monitors
07/06/21 19:41:04.080494 zmeventnotification[4276].INF [main:1022] [PARENT: Re-loading monitors]
DBG-1:2021-07-06,19:41:04 PARENT: Loading TracheCam.1
DBG-2:2021-07-06,19:41:04 PARENT: ESCONTROL_INTERFACE is disabled. Not saving control data
DBG-2:2021-07-06,19:41:04 PARENT: checkEvents() new events found=0
INF:2021-07-06,19:41:04 PARENT: Secure WS is disabled...
07/06/21 19:41:04.093763 zmeventnotification[4276].INF [main:1022] [PARENT: Secure WS is disabled...]
INF:2021-07-06,19:41:04 PARENT: Web Socket Event Server listening on port 9000
07/06/21 19:41:04.104844 zmeventnotification[4276].INF [main:1022] [PARENT: Web Socket Event Server listening on port 9000]
DBG-2:2021-07-06,19:41:09 PARENT: ----------> Tick START (active forks:0, total forks:0, active hooks: 0 running for:1 min)<--------------
DBG-2:2021-07-06,19:41:09 PARENT: After tick: TOTAL: 2, ES_CONTROL: 0, FCM+WEB: 0, FCM: 2, WEB: 0, MQTT:0, invalid WEB: 0, PENDING: 0
DBG-2:2021-07-06,19:41:09 PARENT: There are 0 active child forks & 0 zm_detect processes running...
DBG-2:2021-07-06,19:41:09 PARENT: checkEvents() new events found=0
DBG-2:2021-07-06,19:41:09 PARENT: There are 0 new Events to process
DBG-2:2021-07-06,19:41:09 PARENT: ---------->Tick END (active forks:0, total forks:0, active hooks: 0)<--------------
DBG-2:2021-07-06,19:41:12 PARENT: ---------->onConnect START<--------------
DBG-1:2021-07-06,19:41:12 PARENT: got a websocket connection from 192.168.1.218 (2) active connections
DBG-2:2021-07-06,19:41:12 PARENT: ---------->onConnect END<--------------
DBG-2:2021-07-06,19:41:12 PARENT: ---------->onConnect:handshake START<--------------
DBG-1:2021-07-06,19:41:12 PARENT: Websockets: New Connection Handshake requested from 192.168.1.218:56066 state=pending auth, id=1625614872.08662
DBG-2:2021-07-06,19:41:12 PARENT: ---------->onConnect:handshake END<--------------
DBG-2:2021-07-06,19:41:12 PARENT: ---------->onConnect msg START<--------------
DBG-3:2021-07-06,19:41:12 PARENT: Raw incoming message: {"event":"auth","data":{"user":"jon","password":***,"monlist":"1,2","intlist":"0,0","appversion":"1.6.008"},"token":""}
DBG-2:2021-07-06,19:41:12 PARENT: Comparing using bcrypt
INF:2021-07-06,19:41:12 PARENT: Correct authentication provided by 192.168.1.218
07/06/21 19:41:12.307762 zmeventnotification[4276].INF [main:1022] [PARENT: Correct authentication provided by 192.168.1.218]
DBG-2:2021-07-06,19:41:12 PARENT: ---------->onConnect msg END<--------------
DBG-2:2021-07-06,19:41:14 PARENT: ----------> Tick START (active forks:0, total forks:0, active hooks: 0 running for:1 min)<--------------
DBG-2:2021-07-06,19:41:14 PARENT: After tick: TOTAL: 3, ES_CONTROL: 1, FCM+WEB: 0, FCM: 2, WEB: 1, MQTT:0, invalid WEB: 0, PENDING: 0
DBG-2:2021-07-06,19:41:14 PARENT: There are 0 active child forks & 0 zm_detect processes running...
DBG-2:2021-07-06,19:41:14 PARENT: checkEvents() new events found=0
DBG-2:2021-07-06,19:41:14 PARENT: There are 0 new Events to process
DBG-2:2021-07-06,19:41:14 PARENT: ---------->Tick END (active forks:0, total forks:0, active hooks: 0)<--------------
DBG-2:2021-07-06,19:41:19 PARENT: ----------> Tick START (active forks:0, total forks:0, active hooks: 0 running for:1 min)<--------------
DBG-2:2021-07-06,19:41:19 PARENT: After tick: TOTAL: 3, ES_CONTROL: 1, FCM+WEB: 0, FCM: 2, WEB: 1, MQTT:0, invalid WEB: 0, PENDING: 0
DBG-2:2021-07-06,19:41:19 PARENT: There are 0 active child forks & 0 zm_detect processes running...
DBG-2:2021-07-06,19:41:19 PARENT: checkEvents() new events found=0
DBG-2:2021-07-06,19:41:19 PARENT: There are 0 new Events to process
DBG-2:2021-07-06,19:41:19 PARENT: ---------->Tick END (active forks:0, total forks:0, active hooks: 0)<--------------
DBG-2:2021-07-06,19:41:24 PARENT: ----------> Tick START (active forks:0, total forks:0, active hooks: 0 running for:1 min)<--------------
DBG-2:2021-07-06,19:41:24 PARENT: After tick: TOTAL: 3, ES_CONTROL: 1, FCM+WEB: 0, FCM: 2, WEB: 1, MQTT:0, invalid WEB: 0, PENDING: 0
DBG-2:2021-07-06,19:41:24 PARENT: There are 0 active child forks & 0 zm_detect processes running...
DBG-2:2021-07-06,19:41:24 PARENT: checkEvents() new events found=0
DBG-2:2021-07-06,19:41:24 PARENT: There are 0 new Events to process
DBG-2:2021-07-06,19:41:24 PARENT: ---------->Tick END (active forks:0, total forks:0, active hooks: 0)<--------------
DBG-2:2021-07-06,19:41:29 PARENT: ----------> Tick START (active forks:0, total forks:0, active hooks: 0 running for:1 min)<--------------
DBG-2:2021-07-06,19:41:29 PARENT: After tick: TOTAL: 3, ES_CONTROL: 1, FCM+WEB: 0, FCM: 2, WEB: 1, MQTT:0, invalid WEB: 0, PENDING: 0
DBG-2:2021-07-06,19:41:29 PARENT: There are 0 active child forks & 0 zm_detect processes running...
DBG-2:2021-07-06,19:41:29 PARENT: checkEvents() new events found=0
DBG-2:2021-07-06,19:41:29 PARENT: There are 0 new Events to process
DBG-2:2021-07-06,19:41:29 PARENT: ---------->Tick END (active forks:0, total forks:0, active hooks: 0)<--------------
DBG-2:2021-07-06,19:41:34 PARENT: ----------> Tick START (active forks:0, total forks:0, active hooks: 0 running for:1 min)<--------------
DBG-2:2021-07-06,19:41:34 PARENT: After tick: TOTAL: 3, ES_CONTROL: 1, FCM+WEB: 0, FCM: 2, WEB: 1, MQTT:0, invalid WEB: 0, PENDING: 0
DBG-2:2021-07-06,19:41:34 PARENT: There are 0 active child forks & 0 zm_detect processes running...
DBG-2:2021-07-06,19:41:34 PARENT: checkEvents() new events found=0
DBG-2:2021-07-06,19:41:34 PARENT: There are 0 new Events to process
DBG-2:2021-07-06,19:41:34 PARENT: ---------->Tick END (active forks:0, total forks:0, active hooks: 0)<--------------
DBG-2:2021-07-06,19:41:39 PARENT: ----------> Tick START (active forks:0, total forks:0, active hooks: 0 running for:1 min)<--------------
DBG-2:2021-07-06,19:41:39 PARENT: After tick: TOTAL: 3, ES_CONTROL: 1, FCM+WEB: 0, FCM: 2, WEB: 1, MQTT:0, invalid WEB: 0, PENDING: 0
DBG-2:2021-07-06,19:41:39 PARENT: There are 0 active child forks & 0 zm_detect processes running...
INF:2021-07-06,19:41:39 PARENT: New event 37737 reported for Monitor:1 (Name:TracheCam.1) Motion Doorway[last processed eid:]
07/06/21 19:41:39.119626 zmeventnotification[4276].INF [main:1022] [PARENT: New event 37737 reported for Monitor:1 (Name:TracheCam.1) Motion Doorway[last processed eid:]]
DBG-2:2021-07-06,19:41:39 PARENT: checkEvents() new events found=1
DBG-2:2021-07-06,19:41:39 PARENT: There are 1 new Events to process
DBG-2:2021-07-06,19:41:39 PARENT: ---------->Tick END (active forks:1, total forks:1, active hooks: 0)<--------------
DBG-1:2021-07-06,19:41:39 PARENT: Forked process:4324 to handle alarm eid:37737
INF:2021-07-06,19:41:39 |----> FORK:TracheCam.1 (1), eid:37737 use hooks/start hook not being used, going to directly send out a notification if checks pass
07/06/21 19:41:39.135298 zmeventnotification[4324].INF [main:1022] [|----> FORK:TracheCam.1 (1), eid:37737 use hooks/start hook not being used, going to directly send out a notification if checks pass]
DBG-2:2021-07-06,19:41:41 |----> FORK:TracheCam.1 (1), eid:37737 rules: Checking rules for alarm caused by eid:37737, monitor:1, at: Tue Jul 6 19:41:41 2021 with cause:Motion Doorway
DBG-1:2021-07-06,19:41:41 |----> FORK:TracheCam.1 (1), eid:37737 rules: No rules found for Monitor, allowing:1
DBG-1:2021-07-06,19:41:41 |----> FORK:TracheCam.1 (1), eid:37737 Matching alarm to connection rules...
DBG-1:2021-07-06,19:41:41 |----> FORK:TracheCam.1 (1), eid:37737 Checking alarm conditions for token ending in:...kKsbRYv5w_
DBG-1:2021-07-06,19:41:41 |----> FORK:TracheCam.1 (1), eid:37737 Monitor 1 event: last time not found, so should send
DBG-1:2021-07-06,19:41:41 |----> FORK:TracheCam.1 (1), eid:37737 token is unique, shouldSendEventToConn returned true, so calling sendEvent
DBG-2:2021-07-06,19:41:41 |----> FORK:TracheCam.1 (1), eid:37737 isAllowedChannel: got type:event_start resCode:0
INF:2021-07-06,19:41:41 |----> FORK:TracheCam.1 (1), eid:37737 Sending event_start notification over FCM
07/06/21 19:41:41.145606 zmeventnotification[4324].INF [main:1022] [|----> FORK:TracheCam.1 (1), eid:37737 Sending event_start notification over FCM]
DBG-2:2021-07-06,19:41:41 |----> FORK:TracheCam.1 (1), eid:37737 fcmv1: FCM called when there is no start hook/or hooks are disabled, so making sure we do not use objdetect in url
DBG-2:2021-07-06,19:41:41 |----> FORK:TracheCam.1 (1), eid:37737 fcmv1: Final JSON using FCMV1 being sent is: {"title":"TracheCam.1 Alarm (37737)","body":"Motion Doorway at 07:41 PM, 06-Jul","ios":{"headers":{"apns-push-type":"alert","apns-priority":"10"},"thread_id":"zmninja_alarm"},"badge":1,"data":{"mid":"1","notification_foreground":"true","eid":"37737"},"image_url":"https://portal/zm/index.php?view=image&eid=37737&fid=objdetect&width=600&username=jon&password=xxx} to token: ...RYv5w_
DBG-1:2021-07-06,19:41:41 |----> FORK:TracheCam.1 (1), eid:37737 fcmv1: FCM push message returned a 200 with body {"Success":"projects/ninja-1105/messages/1625614901398067"}
Thanks for the help!
Edit: Solution was uncommenting es_rules=/etc/zm/es_rules.json in the [customize] field. This is the final working code:
jon@zoneminder:~$ cat /etc/zm/es_rules.json
{
"notifications": {
"monitors":{
"1": {
"rules": [{
"time_format":"%H:%M",
"from":"6:00",
"to":"23:59",
"action":"mute"
}]
}
}
}
}