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 something that Apilio can help you with, as it lets you orchestrate all your actions to choose their order and timings when they should be triggered from IFTTT. No coding is needed, you just need to configure Apilio and connect your IFTTT applets.
You can create so many different behaviours! A few examples of these:
- You can turn on a switch, but only for 30 minutes at a time.
- Dim your lights progressively through 10 stages from 100% to 0%.
- Or maybe you want to turn off all the lights in your (smart)home when leaving, but give you 10 minutes of light to find your way out safely.
Whatever your application, let’s see how you can add a delay to your IFTTT actions with Apilio.
Creating your action chain in your logicblock
When setting up your actions in your logicblock, you will add them as a list. Apilio will execute each action in the order they appear in the action chain, from top to bottom.
If there is a delay specified, Apilio will queue your actions and will fire them, one at a time, when their time comes. Delays are defined in seconds and can be any value from 0 to 3600 seconds, this is, 1 hour.
In this example, when the logicblock is evaluated and it determines it is time to run our positive result list of actions, it will:
- first turn on a switch (which we signal to IFTTT via webhooks with the event turn_on_switch immediately)
- 10 minutes later (10 minutes * 60 seconds = 600 seconds), it will turn the same switch off (which we indicate to IFTTT via the webhooks event turn_off_switch).
Actions are queued and delays are added up
It’s important to consider that your action’s delay starts counting down as soon as the previous action is executed. This means all your delays will add up as Apilio progresses through the queue of actions. So for example if you configure three actions:
Turn on the lights (immediately)
Dim the lights to 50% 10 minutes later
Turn off the lights 5 minutes later
This means that: the first action will be executed immediately, the second one 10 minutes later, and the third one 5 minutes after the second one, or, adding all the delays up, 15 minutes after the first action.
What happens if I…
Add a new action when existing ones are already queued
After the logicblock has evaluated, all the existing configured actions are collected and saved for execution. If you add an action to your logicblock while the previous ones are pending, it will not be run until the next logicblock evaluation.
Delete a action when it had already been queued
If you delete an action from the logicblock configuration, and the action had already been queued but has not been executed yet, it’s execution will be skipped.
Edit an action after it had been queued
If you change a parameter value of a pending action, the last saved action configuration that was the one when the action was queued will be used. The new configuration will be used when the logicblock is evaluated again and the actions are to be run.
If you want to know more about how to get started with Apilio, have a look at our getting started guide post.