Door (Contact Sensor) No Repeat Delay


#1

Hi
I have a number of Ecolink Contact Sensors on my doors. I have setup a push notification when the doors open. Is there a way to create a no-repeat within a certain time rule? For example when I leave the house I often open and close the door about 10 times as I’m juggling kids, things, trying to keep the cats in and the bugs out etc. It would be great to receive a notification for the first opening, but then no more within, say, 10 mins of the first opening, then after that the sensor rule resets. I’ve tried searching, but can’t seem to find a way to set this up, and am new to ST coding.
Any help would be much appreciated. Hopefully this could a useful app for others too?
Thanks!
Loz


(Gary D) #2

Off the top of my head…

In the event handler for the contact sensor being open, set a variable to “now()”, and use that as a timer. For example:

handlerFunc(evt)
{
   def timePadInMinutes = 5

   // assumes that event was verified to be an open event and other conditions are met
   if ((resetTime == null) ||
     (resetTime > now()))
    {
        resetTime = now() + (timePadInMinutes * 60000) // prevent new processing for xx minutes
        // do processing.
    }
}

#3

Thanks for the reply and the coding suggestion. I’m so new to this that I will have to go and read up on how/where to add this code to the event handler function, but once I figure it out, I’ll let you know how it goes. I appreciate the help!