Difference between revisions of "SMS Notifications"

From ZoneMinder Wiki
Jump to navigationJump to search
Line 7: Line 7:


Follow [https://wiki.zoneminder.com/How_to_get_ssmtp_working_with_Zoneminder How to get ssmtp working with Zoneminder].  
Follow [https://wiki.zoneminder.com/How_to_get_ssmtp_working_with_Zoneminder How to get ssmtp working with Zoneminder].  
=== Tips ===


When testing be aware of the following:
When testing be aware of the following:
Line 13: Line 15:
* When you make the filter you want the 'current' alarms. You don't want old events.
* When you make the filter you want the 'current' alarms. You don't want old events.


This is accomplished with a Date/Time greater than or equal to -1 minute. However, there is no need to set this when testing.
This is accomplished with a Date/Time greater than or equal to -1 minute.  
 
=== Tips ===


* If when testing the filter execute, the 'execute' button becomes unclickable, uncheck then recheck the email option.
* If when testing the filter execute, the 'execute' button becomes unclickable, uncheck then recheck the email option.
Line 33: Line 33:
echo "some text" | mail -s "subject destination@email.com
echo "some text" | mail -s "subject destination@email.com
</pre>
</pre>
* make sure email is checked off in filters. It gets unchecked easily.
* service zoneminder restart


=== Example Filter ===
=== Example Filter ===


For monitoring on the weekend you might have
For monitoring on the weekend you might have
<pre>
<pre>
date/time greater than or equal to -1 minute AND
alarm frames greather than or equal to 1 AND
Weekday equal to Saturday OR
Weekday equal to Saturday OR
Weekday equal to Sunday AND
Weekday equal to Sunday AND
Line 43: Line 50:
date/time greater than or equal to -1 minute
date/time greater than or equal to -1 minute
</pre>
</pre>
TODO TEST
 
Notice that you must include all parameters for each group/set individually when there is an OR.
 


== Notes ==
== Notes ==


Notifications can be set easily if you want alarms emailed whenever an event occurs between a static time, for example between 12AM and 6AM. If you have a situation where you may not want the alarms to send you text messages on occasion, this requires work.  
Notifications are easy if you want alarms emailed between a static time, for example between 12AM and 6AM. If you have a situation where you may not want the alarms to send you text messages on occasion, this requires work.  


A [http://www.github.com/zoneminder/zoneminder/issues/1750 feature in the works] would allow you to set filters based on [https://wiki.zoneminder.com/filter_on_run_states run states], which would mean, you could change the run state at any desired time, and only then would SMS be sent. Until then, you must have duplicate monitors and have the filters activated on only one of them. If you like, you can compile zoneminder from a [https://wiki.debian.org/BuildingTutorial package source] such as the debian package and add the commits manually which is not difficult, at your own risk
A [http://www.github.com/zoneminder/zoneminder/issues/1750 feature in the works] would allow you to set filters based on [https://wiki.zoneminder.com/filter_on_run_states run states], which would mean, you could change the run state at any desired time, and only then would SMS be sent. Until then, you must have duplicate monitors and have the filters activated on only one of them. If you like, you can compile zoneminder from a [https://wiki.debian.org/BuildingTutorial package source] such as the debian package and add the commits manually at your own risk (it is not difficult, but beware updating).


==Resources==
==Resources==

Revision as of 22:38, 24 March 2017

You setup email to point to a text gateway. Setup a filter that monitors the cameras for alarms, and when an alarm is set off you have it send an email to the text gateway. Simple.

You can get images from the alarm embedded in the text (covered in install steps).

Installation

Follow How to get ssmtp working with Zoneminder.

Tips

When testing be aware of the following:

  • Free email services limit how many emails you are allowed to send through SMTP. It helps to disable cron emails.
  • Always test by emailing 1 (or similar low number) results.
  • When you make the filter you want the 'current' alarms. You don't want old events.

This is accomplished with a Date/Time greater than or equal to -1 minute.

  • If when testing the filter execute, the 'execute' button becomes unclickable, uncheck then recheck the email option.
#watch "tail -n 30000 /var/log/syslog | grep sSMTP | tail"
  • When testing use submit at first, not execute. Submit will show you results but not email.
  • If you send email as someone other than root, make sure he is in /etc/ssmtp/revaliases
  • test emails with
cat file | mail -s "subject" destination@email.com
OR
echo "some text" | mail -s "subject destination@email.com
  • make sure email is checked off in filters. It gets unchecked easily.
  • service zoneminder restart

Example Filter

For monitoring on the weekend you might have

date/time greater than or equal to -1 minute AND
alarm frames greather than or equal to 1 AND
Weekday equal to Saturday OR
Weekday equal to Sunday AND
alarm frames greater than or equal to 1 AND
date/time greater than or equal to -1 minute

Notice that you must include all parameters for each group/set individually when there is an OR.


Notes

Notifications are easy if you want alarms emailed between a static time, for example between 12AM and 6AM. If you have a situation where you may not want the alarms to send you text messages on occasion, this requires work.

A feature in the works would allow you to set filters based on run states, which would mean, you could change the run state at any desired time, and only then would SMS be sent. Until then, you must have duplicate monitors and have the filters activated on only one of them. If you like, you can compile zoneminder from a package source such as the debian package and add the commits manually at your own risk (it is not difficult, but beware updating).

Resources