How to add a delay to an IFTTT action

Many times your IFTTT applets are just what you need for your smart applications… if you could just add a small delay to better time some of the actions.

Adding a delay to your IFTTT applets is very easy with Apilio: you’ll need to daisy-chain them and this article will show you how.

Introducing Apilio to add delays to IFTTT actions

Adding a delay to your IFTTT actions is something that Apilio can help you with. This is how things work:

Without delays:

  1. Something happens and an applet on IFTTT triggers a few actions, one after the other

With delays:

  1. Something happens and an applet on IFTTT lets Apilio know
  2. Apilio sends events to IFTTT at specific times, taking into account your delays, so things can be executed by IFTTT when you want to
  3. IFTTT runs the actions when they receive the event from Apilio

We are basically making a sandwich where IFTTT is the bread and Apilio is the PB&J

:bread: APILIO :bread:

No coding is needed, you just need to specify the delay in Apilio and connect your IFTTT applets.

A step-by-step example

In this example, I’m not going to setup any conditions in Apilio, I’m assuming you are doing that in IFTTT. My example is as follows:

  • If my phone connects to my home wifi
  • Then turn the foyer lights on
  • And, 5 minutes later, turn the foyer lights off

1. Create a placeholder Logicblock in Apilio

Go to https://app.apilio.com/logicblocks and create a new Logicblock. You just need to give it a name at this point, for example “foyer_lights”. We’ll use this name shortly. Save your logicblock.

2. Connect the Apilio service on IFTTT

Go to:

3. Create the IF THIS THEN APILIO applet that starts your routine

For example, I want to start my routine when my phone connects to my home wifi. I will setup an applet that if my phone connects to a specific wifi, then I will initiate a Logicblock evaluation in Apilio:

You’ll need to setup an applet that starts with your desired triggers, and that calls Apilio at the end. The “THEN” part calls Apilio’s Logicblock that you created on the second step, “foyer_lights”.

4. Create your IFTTT actions in Apilio and specify any delays

Go back to Apilio and edit your “foyer_lights” Logicblock. We are going to add the two actions we want to execute: turn the lights on and then, 5 minutes later, turn the lights off. These two IFTTT actions are just event names that will be sent to IFTTT to orchestrate your actions at your desired times. 5 minutes is: 5 * 60 seconds = 300 seconds.

These are the two actions you’ll have in the Logicblock:

5. Connect your actions to IFTTT applets: IF APILIO THEN THAT

Your applet that catches the first event, foyer_light_on looks like this:

In my example, I’m using a LIFX lightbulb, but you could replace it with any other service.

And the second action, the one that is being delayed, is using the second event, foyer_light_off.

IFTTT will receive this event 5 minutes after the other, thus delaying this action.

6. All done!

Great work, now when your phone connects to your home wifi, the foyer lights will turn on for a bit when you get home.

Applets that don’t count towards your 3-applet limit

Find the applet you need on our list and just enable it, these don’t count towards the 3-applet limit:

I don’t want to turn the lights on if it’s daytime!

I can hear you say: “But Anna, isn’t it wasteful to turn the lights on if it’s daytime?” Glad you asked! I think you are going to like this expanded example:

:bulb: Related articles

2 Likes

What happens if you trigger the evaluation URL the second time before the first has finished all the actions. Does it stop the first and start the second or queue the second after the first has finished?

1 Like

This depends on whether the first action of an action chain has already started or not.
If the first action was executed, the rest of the actions will not be touched and run as scheduled. The second action chain will run independently in parallel (vs. being queued at the end of the first chain).

If the first action has not been started yet (e.g. if you have set the execution mode to “warn” or the first action has a delay), the complete old chain will be cancelled and replaced with the new one.

The reason for this behaviour is the assumption that a sequence of actions forms a bundle of actions that are meant to run through every time to make sense.

1 Like

I want to have the system notify me when my front door is open for more than 10 minutes. Currently I managed to get this working using Google Scripts. Basically IFTTT calls the script when the door opens. The script calls the Apilio door_is_open and sets it to true and the script then creates a timer-trigger that will wait for 10 minutes before calling the Apilio door_open_more_than_10_minutes variable. The logiblock will then evaulate to true (on changing variable values) and call IFTTT to send a notification. If the door is closed before 10 minutes have expired, the door_is_open variable will immediatly be set to false and the logiblock will evaluate to false and no notifications will be sent. How can I achieve this without Google scripts?

Hi Geert,
Apilio has not yet a feature to keep track of timing changes and re-evaluate logicblocks. We have that on our list, but I don’t have an ETA yet.
There are some workarounds mentioned here: Evaluation when conditions change (not variables)
A more advanced workaround is described by another community member here:
https://iused2besmart.wordpress.com/2019/09/04/using-ifttt-and-apilio-v2/

Hi Philipp,

As I mentioned earlier the ‘more advanced workaround’ you mentioned no longer works as it uses the no longer supported direct URLs for changing variable values.

I have been busy creating a new solution. In my case, I want to receive (multiple) notifications whenever my front-door (with a Nuki smart lock)
is open for more than 5 minutes. A complicating fact is that when somebody opens and closes the door within a few seconds, the triggers sometimes arrive in the wrong order (first close door trigger then open door trigger). In my solution, I, therefore, needed an extra delay action (on the close door trigger). I have documented everything in this document https://drive.google.com/open?id=1AP2qp6LFKDPwpF7euZPSrKDIxTigaHpg . I hope I can make somebody happy with this.

2 Likes

Great documentation, thanks for sharing!
We’d like to offer an in-app solution to detect “is open for more than 5 minutes”, which would make your setup a lot simpler. We are dying to for being able to work on it :cry:

1 Like

Do you think if it is possible/feasible if there can be a function to halt the logic block which have delays queued?
Use case is: I evaluated a logic block that has 3 IFTTT with 5 mins delay in between each one. But then later I decided that I want to stop the entire queue such that the remaining IFTTT block will not be executed.

For thoughts. :smiley:

1 Like

Great timing as I had exactly the same issue today. Wanted to stop a 20min delay on an action chain. @pebneter :mage:?

The action chain is seen as an integral package that should usually not be broken, so therefore we never implemented a way to break it while running.
Sure it would be technically feasible, although not so easy because as a user, would need to get a constantly updated status of the actions in the queue.

1 Like

OK so in that case maybe a better approach is to create chains of logicblocks so that the completion of one can trigger the start of another. That would give us more control.

Hi all, this article has been updated with a new step-by-step example to help you add a delay to an IFTTT action, while keeping your conditions you had setup in IFTTT. I hope that helps :smiley:

2 Likes