Limit SMS notifications for a frequently recurring event

Started by detroit_johnny, October 25, 2015, 11:16:47 PM

detroit_johnny

I'm wondering how one would format an event in the metrics.js file to limit the number of SMS being sent out if a certain event is happening quite often?  For example, I am monitoring the house AC voltage level, and if it goes below say 105 volts or off completely, I don't want to get an SMS over and over again until the voltage level comes back up to normal.  I can make it send me SMS below 105 volts but I'm not sure how to limit the message frequency.

Felix

You can setup a global variable in gateway.js

global.handleNodeEvents = false;

Only send when your condition is met and the variable is FALSE, then set it to TRUE after the first send. When the condition goes away set the var to FALSE.