Its good to know as soon as possible if there is an issue with an installed energy monitor, such as the base station dropping offline or a problem with RF connection. This is a rough and ready first implementation of an email notifier for emoncms, that sends you an email to say that a feed has become inactive or a feed is equal to a certain value. No longer are the days when you log in to emoncms just to find that there are two days of missing data as happened to me on feb 6-7 here
1) Click on a feed in the feed list to bring up the feed view page, scroll down to the bottom and click on set notifications:
2) Select the events that you want notifications for. Notification on value and on inactive both work. Periodic notification is yet to be implemented.
3) Click on edit mail settings and enter in the recipient email address. This only has to be done once as it is the same for all notifications.
If you want to send the notifications to multiple addresses, just put in a comma between each address.
4) Unplug your emonbase!! and check your email:
It can be tried out here: http://vis.openenergymonitor.org/emoncms3
Behind the scenes
1) To use the notifier on your own server you will need php mail installed, to do this on ubuntu enter the following into terminal
sudo apt-get install php-pear
sudo pear install mail
sudo pear install Net_SMTP
sudo pear install Auth_SASL
sudo pear install mail_mime
2) In emoncms3/Includes copy the default.mail_settings.php file and rename too mail_settings.php and enter in your mail server settings.
3) Open the file cron.php and change the key password to something unique, this is used to ensure that only you can run the cron.php script.
4) Create a cronjob, in ubuntu start by opening crontab: $ crontab -e
Then add a cronjob that calls the cron.php script including the key that you created. To call the cron.php script once a minute try the following:
# m h dom mon dow command
* * * * * wget -q -O /dev/null "http://localhost/emoncms3/cron.php?key=YOURKEY
5) If your using the same database as a previous emoncms version, you will need to create the new notify database tables. This can be done in index.php by pasting require "Includes/setup.php"; in the top. Its probably worth removing it afterwards.
6) Configure your feeds as in the screens above! To engage in discussion regarding this post, please post on our Community Forum.