Cooldown for mail or event
-
Good Afternoon,
Is there a setting somewhere for cool downs on events or the email handler on an event?
I have a boolean point that when false an event is triggered. If that point starts flapping between true and false I don't want 20 emails to be sent in the next 30 seconds about it.
I know for high limit events you can set how long it needs to stay at a certain threshold however that is not the functionality I am looking for.
This would be something like a reset limit except for it being a time count down instead of point value threshhold.
Thanks!
-
I take it you are useing the point event detectors. Use the state detector and set a period in the duration.
-
Hi Xof1986,
There are not any such options builtin currently. You could hack it up by calling
model.clear();
in the script body of the email event handler to make the FTL file fail to process, and then the email will not be sent. I see an easy way to put this into the script, at least, so that one could detect if they didn't want to send an email for whatever reason they could return. Perhaps mitigating floods of emails with an explicit timer setting is common enough that it would warrant being outside the general purpose script body for simplicity.It sounds like a script like this would prevent email in the current release in your situation, but it will produce an error in the log file,
var values = p.last(10); for(var k = values.length-1; k > 0; k+=1) { //> 0 to not include the current value if( values[k].booleanValue === false && p.time - values[k].time < 60000 ) { model.clear(); //Happened within 1 minute, cause an FTL error instead of another email return; } }
It would be even easier if you set a point from the script body whenever you sent the email, then used that point's timestamp in the email handler to see if you should clear the model.
I will ensure that a better way to prevent emails from sending using the script makes it into 3.4.2, since it should be very simple to do.
Edit: I have added the ability for a script on an email handler to
return CANCEL;
orreturn UNCHANGED;
to prevent sending the email. I suspect it will be a few weeks before we release 3.4.2 unless major bugs are discovered.