zmeventnotification - FCM push returned a 200

Discussion topics related to mobile applications for ZoneMinder
Post Reply
SkippyDo
Posts: 186
Joined: Mon Nov 20, 2017 6:49 pm

zmeventnotification - FCM push returned a 200

Post by SkippyDo » Sat Jun 13, 2020 6:25 am

New installation of zmeventnotification (on Debian 10) with ZM 1.34.15. SSL certs are from/via Letsencrypt.

I am not getting the push notification picture. Per the FAQ I have hard-coded an image (the one referenced in the FAQ), but no image is displayed on my Android phone. zmeventnotification.ini is configured for fcm, SSL is enabled and include-picture is set to "yes." Not yet using Hooks.

I am able to receive the push notifications from my server to zmNinja, but no picture. The only log traces I'm finding are from zmeventnotification.log (here's a relevant chunk from it):

Code: Select all

CONSOLE INF:2020-06-12,20:28:04 PARENT: New event 768 reported for Monitor:1 (Name:Driveway) Forced Web[last processed eid:767]
CONSOLE DBG-2:2020-06-12,20:28:04 PARENT: checkEvents() new events found=1
CONSOLE DBG-2:2020-06-12,20:28:04 PARENT: There are 1 new Events to process
CONSOLE DBG-1:2020-06-12,20:28:04 PARENT: Forked process:22422 to handle alarm eid:768
CONSOLE INF:2020-06-12,20:28:04 |----> FORK:Driveway (1), eid:768 use hooks/start hook not being used, going to directly send out a notification if checks pass
CONSOLE DBG-1:2020-06-12,20:28:06 |----> FORK:Driveway (1), eid:768 Matching alarm to connection rules...
CONSOLE DBG-1:2020-06-12,20:28:06 |----> FORK:Driveway (1), eid:768 Checking alarm rules for token ending in:...8ag71_7v0D
CONSOLE DBG-1:2020-06-12,20:28:06 |----> FORK:Driveway (1), eid:768 Monitor 1 event: should send out as  776.471899986267 is >= interval of 0
CONSOLE DBG-1:2020-06-12,20:28:06 |----> FORK:Driveway (1), eid:768 shouldSendEventToConn returned true, so calling sendEvent
CONSOLE DBG-2:2020-06-12,20:28:06 |----> FORK:Driveway (1), eid:768 isAllowedChannel: got type:event_start resCode:0
CONSOLE INF:2020-06-12,20:28:06 |----> FORK:Driveway (1), eid:768 Sending event_start notification over FCM
CONSOLE DBG-2:2020-06-12,20:28:06 |----> FORK:Driveway (1), eid:768 FCM called when there is no start hook/or hooks are disabled, so making sure we do not use objdetect in url
CONSOLE DBG-2:2020-06-12,20:28:06 |----> FORK:Driveway (1), eid:768 Final JSON being sent is: {"to":"eia1djmzcsc:APA91bEXmWm0X1LW2a-XTySMDe6_tAd-AhVBImmA2sD5PHf_qvk8j_ITYPQXUDl7cEgJX0FNGngPPNHdcfbS57SMn_y0IA9oQeKrdpsbZxlInxTpnmxnpq5cxQxQ-zUpJh8ag71_7v0D","data":{"eid":"768","picture":"https://upload.wikimedia.org/wikipedia/commons/5/5f/Chinese_new_year_dragon_2014.jpg&username=zmuser&password=xxx to token: ...1_7v0D
CONSOLE DBG-1:2020-06-12,20:28:07 |----> FORK:Driveway (1), eid:768 FCM push message returned a 200 with body {"multicast_id":5063048509924850260,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"0:1592018887273676%311426bef9fd7ecd"}]}
CONSOLE INF:2020-06-12,20:28:25 |----> FORK:Driveway (1), eid:768 Event 768 for Monitor 1 has finished
CONSOLE INF:2020-06-12,20:28:27 |----> FORK:Driveway (1), eid:768 end hooks/use hooks not being used, going to directly send out a notification if checks pass
CONSOLE DBG-1:2020-06-12,20:28:29 |----> FORK:Driveway (1), eid:768 Matching alarm to connection rules...
CONSOLE DBG-2:2020-06-12,20:28:29 |----> FORK:Driveway (1), eid:768 isAllowedChannel: got type:event_end resCode:0
CONSOLE INF:2020-06-12,20:28:29 |----> FORK:Driveway (1), eid:768 Sending event_end notification over FCM
CONSOLE DBG-2:2020-06-12,20:28:29 |----> FORK:Driveway (1), eid:768 FCM called when there is no start hook/or hooks are disabled, so making sure we do not use objdetect in url
CONSOLE DBG-2:2020-06-12,20:28:29 |----> FORK:Driveway (1), eid:768 Final JSON being sent is: {"priority":"high","to":"eia1djmzcsc:APA91bEXmWm0X1LW2a-XTySMDe6_tAd-AhVBImmA2sD5PHf_qvk8j_ITYPQXUDl7cEgJX0FNGngPPNHdcfbS57SMn_y0IA9oQeKrdpsbZxlInxTpnmxnpq5cxQxQ-zUpJh8ag71_7v0D","data":{"myMessageId":2,"message":"Forced Web:  ended at 08:28 PM, 12-Jun","mid":"1","title":"Ended:Driveway Alarm (768)","summaryText":"alarmed image","priority":1,"style":"picture","icon":"ic_stat_notification","badge":"1\\nmessage","picture":"https://upload.wikimedia.org/wikipedia/commons/5/5f/Chinese_new_year_dragon_2014.jpg&username=zmuser&password=xxx to token: ...1_7v0D
CONSOLE DBG-1:2020-06-12,20:28:30 |----> FORK:Driveway (1), eid:768 FCM push message returned a 200 with body {"multicast_id":345794579499863662,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"0:1592018910087140%311426bef9fd7ecd"}]}
CONSOLE DBG-1:2020-06-12,20:28:34 |----> FORK:Driveway (1), eid:768 exiting
CONSOLE DBG-1:2020-06-12,20:28:34 |----> FORK:Driveway (1), eid:768 Ending process:22422 to handle alarms

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

Re: zmeventnotification - FCM push returned a 200

Post by asker » Sat Jun 13, 2020 2:37 pm

When testing with the dummy image, don't pass username/password (comment out picture_portal_username and picture_portal_password in zmeventnotification.ini) - you should get the image on your phone.
--
My collection of ZoneMinder learnings:
https://wiki.zoneminder.com/Various_ZM_thoughts

SkippyDo
Posts: 186
Joined: Mon Nov 20, 2017 6:49 pm

Re: zmeventnotification - FCM push returned a 200

Post by SkippyDo » Sun Jun 14, 2020 1:07 am

OK. That got me the test picture. Hope I never see THAT in my driveway! :lol:

With "fixes" in place I am now able to get an event picture pushed.

There were several issues needing corrections:

1. In secrets.ini I had to change ZMES_PICTURE_URL to use "fid=1" from "fid=objdetect" because I'm not currently using hooks; also, there's a mention of setting this to "snapshot," but I couldn't get that to work in which case I resorted to just "1" (it's not, however, the first alarmed frame, which is what I'd want).

2. I had to create a ZM user for these queries; for some reason I'd thought that it was, as the default install goes, "zmuser." I have a global "zmuser" account but not one within the ZM database Users table- I'm thinking that something here might need to be straightened out.

3. For my monitors I had to enable Save Jpegs (to saving Frames) as I hadn't been saving any (thought that I didn't need to given that I was now using video).

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

Re: zmeventnotification - FCM push returned a 200

Post by asker » Sun Jun 14, 2020 4:03 pm

You can use fid=alarm for first alarmed match. If that doesn't work, take a look at what the logs say. Sometimes, it can be the case that the alarmed frame was not written to disk before the ES asks for it - this should really not happen with the version of ZM you are on. But if it does, add a wait for a second in the config. In any case, check logs.
--
My collection of ZoneMinder learnings:
https://wiki.zoneminder.com/Various_ZM_thoughts

SkippyDo
Posts: 186
Joined: Mon Nov 20, 2017 6:49 pm

Re: zmeventnotification - FCM push returned a 200

Post by SkippyDo » Mon Jun 15, 2020 4:52 am

Interestingly I set it back to "snapshot" and it's working. So... now I'm off to tackle getting hooks to work!

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests