Alert if Variable Stays True for X minutes

Skip to first unread message

Jun 2, 2019, 10:22:40 PM6/2/19
to Apilio
I have Wyze contact sensors that can trigger alerts but am looking for a way to trigger those alerts only if they stay "open" for X minutes.  The native IFTTT app and the Wyze app doesn't work well enough and I would like to try to combine with IFTTT to send text alerts, etc.  It doesn't sound like the delay feature would work in this situation.  I was thinking of possibly a delay with a call to IFTTT that then triggers another logicblock, but not sure if that is possible 

  • IFTTT "Sensor Opens" - Set Boolean of "Sensor Open" = true (with another IFTTT that sets Boolean to false when it closes)
  • Logicblock#1 if sensor open = true, then trigger webhook at IFTTT "Check at 10 mins" after delay of 10 mins
  • IFTTT Webhook "Check at 10mins" triggered - sets Boolean of "Time to Check" = true
  • Logicblock#2 if sensor open = true and time to check = true, then trigger webhook at IFTTT to send text and webhook at IFTTT to reset Boolean time to check = F

I think the above will work but wasn't sure if I would create a loop or other problems
Thanks in advance for any help!


Jun 3, 2019, 1:25:33 AM6/3/19
to Apilio
I may have overlooked something, but from what I can see if you're telling the logicblocks to trigger any time a connected condition changes you might have an issue with the "Time to Check" condition.

If a sensor opens (Sensor Open = true), logicblock #1 will trigger and set a 10-minute delay before setting "Time to Check" true. Nothing cancels this, it will always set "Time to Check" = true 10 minutes after being set in motion by "Sensor open".

If the sensor remains open, then in 10 minutes "Time to Check" becomes true, logicblock #2 fires and sends a text and sets "Time to Check" back to false.
But, if the sensor closes before the 10 minutes, it will set "Sensor Open" = false, so both logicblock #1 and #2 will evaluate false and "Time to Check" will remain true. The next time the sensor opens "Sensor open" will be true, which will trigger both logicblock #1 (10-minute delayed "Time to Check" = true) and logicblock #2  which will evaluate true because "Time to Check" was still true from the last time (so you'll get a text immediately even though the sensor only opened the second time).

I *think* you need to add an action when logicblock #2 evaluates false to reset "Time to Check" to false as well. That way if the sensor is closed before 10 minutes, when logicblock #2 runs it will reset everything to false again so your routine will start with a clean slate.



Jun 3, 2019, 10:50:54 AM6/3/19
to Apilio
Hi there,
thanks for the great discussion!
You are right, what Apilio does not support yet is an active "watcher" that re-checks a timing restriction by itself - but that's something we'd really like to implement.

As a workaround, you could setup a scheduled (15 minutes is the lowest you can get with IFTTT) call to the "evaluate" function of a logicblock.
For the "Senor Open" variable: Setup it up just as you describe and set a timing restriction on the condition for "not been modified" for a certain amount of time.
The only downside is that depending on the moment the sensor was set to open, the time until Apilio is triggered and sends a message may vary.

Jun 3, 2019, 12:16:17 PM6/3/19
to Apilio
Thank you for those tips!  

You are right about you "need to reset" - that is the part I missed.  I was getting some immediate texts in my testing.

That's a great idea on the IFTTT 15 min call to check the logicblock, that seems a little simpler.  I'll try that in conjunction to see which is more reliable.  15 mins is probably short enough for my purpose.   
Reply all
Reply to author
0 new messages