ZoneMinder with PushOver notifications

Here is a quick how-to on getting ZoneMinder to notify you using PushOver messages, when your ZM has detected something of interest.

The end result looks like this on your smartphone:
SmartPhone displaying Pushover message

To get this working, you will need a free PushOver account. Register on http://pushover.net/
When you have your account, make note of your user key - a long string. Something like u5xb6GGvCZpifrwjvy97aApnst0T79.
When you have the account, you have to register an application. Also done on the PushOver website. Make note of the API Token/Key. Again a long string.

Install the PushOver app for your smartphone. This will cost you some money, nothing much though. Pair the app with your PushOver account. Links to the apps can be found on the PushOver website.

Now to the message-pushing from ZoneMinder.

Log on to your ZoneMinder server as root.
Create a script:
mkdir /opt/pushover

nano /opt/pushover/notify_by_pushover.sh

#!/bin/sh
curl -F "token=myURRBPQR5hcEF6ycsmNV45rmHndE" \
-F "user=u5xb6GGCZpifrwjvy97aApnst0T79" \
-F "title=ZM event" \
-F "message=$1" \
https://api.pushover.net/1/messages
exit 0

Your user key from PushOver needs to go in the user= part of the script.
Your API Token/Key from PushOver should be entered in the token= part of the script.
The token and user keys in my sample above are made up, and will not work for you.

chmod +x /opt/pushover/notify_by_pushover.sh which makes the script executable.

Now a quick command-line test of the script:

/opt/pushover/notify_by_pushover.sh Testing

Which should output something likes this in your terminal window.
{"status":1,"request":"c2eae85942815c683b0bcbcd05869cc7"} The status 1 is a sign that the Pushover REST service received the message and is working on it.
Within a minute you should get a PushOver message in your PushOver app.
Sample PushOver message

Now to using the Script in ZoneMinder.

Open your ZoneMinder web UI.
Click the Filters link/button.
Fill in a new filter like what I have here
Filter Configuration Make sure to specify Limit to first, and make it a small number - less than 10. Or else you will soon get PushOver messages for all the existing entries in your ZM database. That could be thousands of messages.
You can see that I have specified that the Duration of a ZM event should be greater than 20 (seconds) and that the Total score of the event should be greater than 350.
Those are the search criteria for the filter. Exactly what scores you want to specify here will vary according to needs.
And then of course you need to specify the path to the script that you just made.
Save the filter.
Saving Filter configuration Give the filter a name, remember to check off that it is to run in the background.

That is it.

To check if it works, I suggest you do two things.

in the terminal check out the logfile.

tail -f -n 15 /var/log/messages

This will generate output like this. Updating the terminal as things get written to the logfile. Example:

Apr  8 11:28:04 zoneminder zma[7109]: INF [CAM_1: 59176 - Gone into alarm state]
Apr  8 11:28:04 zoneminder zma[7109]: INF [CAM_1: 59176 - Opening new event 21869, alarm start]
Apr  8 11:28:04 zoneminder zma[7109]: INF [CAM_1: 59178 - Gone into alert state]
Apr  8 11:28:05 zoneminder zma[7109]: INF [CAM_1: 59191 - Gone back into alarm state]
Apr  8 11:28:06 zoneminder zma[7109]: INF [CAM_1: 59200 - Gone into alert state]
Apr  8 11:28:06 zoneminder zma[7109]: INF [CAM_1: 59202 - Gone back into alarm state]
Apr  8 11:28:08 zoneminder zma[7109]: INF [CAM_1: 59224 - Gone into alert state]
Apr  8 11:28:09 zoneminder zma[7109]: INF [CAM_1: 59226 - Gone back into alarm state]
Apr  8 11:28:10 zoneminder zma[7109]: INF [CAM_1: 59240 - Gone into alert state]
Apr  8 11:28:11 zoneminder zma[7109]: INF [CAM_1: 59247 - Gone back into alarm state]
Apr  8 11:28:12 zoneminder zma[7109]: INF [CAM_1: 59260 - Gone into alert state]
Apr  8 11:28:14 zoneminder zmfilter[6075]: INF [Executing '/opt/pushover/notify_by_pushover.sh /usr/share/zoneminder/www/events/1/16/04/08/11/27/40']
Apr  8 11:28:15 zoneminder zma[7109]: INF [CAM_1: 59285 - Left alarm state (21869) - 134(60) images]
Apr  8 11:28:15 zoneminder zma[7109]: INF [CAM_1: 59285 - Closing event 21869, alarm end]

Now go wave at your camera to trigger an event.
Look for a line in the log like this one:
[Executing '/opt/pushover/notifybypushover.sh /usr/share/zoneminder/www/events/1/16/04/08/11/27/40']

Note how ZoneMinder appends the path to the on-disk folder containing the event files. Nice to know.

And then you should be getting a PushOver event in the app.

Hope this is of use to you.