Create a dynamic condition based on the current time

Hi everyone.

I have a sensor attached to my garage door that triggers whenever the door is opened, or closed. The sensor is connected to Smart Life (Tuya) and I have connected Smart Life to Apilio. I am also using IFTTT for notifications, but that’s not relevant here.

My requirement is that I would like to trigger a notification (via IFTTT) 30 minutes after the garage door has been opened and every 30 minutes thereafter. The problem I am finding is that I can create a condition that triggers every 30 minutes based on the time I save the condition, or the configured number of minutes past the hour, but I have not been able to find a way in which to start the timer whenever the door is opened. The result is that the first message could be sent anything from immediately when the door is opened up to the required 30 minutes.

Does anyone have a way in which to achieve my desired configuration?


1 Like

Follow these steps:

  1. Create a Boolean Variable called “Timer” with “FALSE” value

  2. Create a Boolean condition called “Timer30mins”, choose “Timer” as the Boolean variable, “True” as required variable state, check the “Trigger condition” option and, finally (this is the secret sauce) set Delay to 30 minutes.

  3. Create a logicblock “DoorOpenOrCloses” that, when the door is opened, sets boolean variable Timer to TRUE (via webhook), and when it is closed, sets boolean variable it to FALSE (via webhook).

  4. Create another logicblock “DoorIsOpenReminder” which just one condition: “Timer30mins”. Include the actions you want (e.g. notification “door is still open”) and don’t forget to add 2 additional actions at the end: set Timer to FALSE (via webhook) and then set Timer to TRUE (via webhook). This will make Timer30mins condition trigger again after 30 mins.

So this is how it will work:

When the door is open:

  1. Door is open => Logicblock “DoorOpenOrCloses” is triggered => Timer variable = TRUE
  2. After 30 mins, Timer30mins condition will become TRUE (due to the delay we added) => Logicblock “DoorIsOpenReminder” is triggered => [youractions here], Timer = FALSE, Timer = TRUE
  3. After 30 mins, Timer30mins condition will become TRUE again => Logicblock “DoorIsOpenReminder” is triggered => [youractions here], Timer = FALSE, Timer = TRUE

When the door is closed:

  1. Door is closed => Logicblock “DoorOpenOrCloses” is triggered => Timer variable = FALSE
    No more reminders

In my head, this should work. Now go and try it :smile:


:ok_hand: Very creative solution @teknofilo! :grinning:

1 Like

Thank you very much for your reply @teknofilo. You logic is sound and it works really well. I did make a couple of adjustments which are specific to my configuration. These are as follows:

  1. From 3, I created two logic blocks and two conditions, one each for open and close events. This is because Smart Life sends an event for either open, or close and not a toggle state event.

  2. From an aesthetic point of view I want the notification to provide the number of minutes that the door has been open. To do this, I created and numeric variable “doorOpenMinutes” and set the default value to 0 (doesn’t matter really). I then added a webhook to my “garageDoorOpen” Logicblock that sets “doorOpenMinutes” to 0. Next, I added another webhook to my notification Logicblock that increments the counter by the desired amount (as defined in the delay defined in point 2 of your reply. Importantly, I moved this above the notification so the value is incremented before the notification is sent. Finally, I added “doorOpenMinutes” to the notification I send to IFTTT.

1 Like

Very nice addition to have the number of minutes in the notification!


I have a similar setup at home with the garage door and the street door. I only get one notification (not periodic ones) and I make all my Alexa smart speakers to warn about it (“Garage door is open after 30 minutes!”) when that happens.


I like the idea of an announcement from Alexa.

1 Like

VoiceMonkey ( is your friend :grinning:

1 Like