How to setup and use time conditions

In Apilio, you can setup time conditions to control when your actions are allowed to run. Conditions are the rules in your Logicblocks (your routines). Time Conditions are particularly handy as they allow you to reliably schedule automated activities at home or at work.

Let’s see how you can set these Conditions up:

What’s a Time Condition?

Time Conditions relate to times of the day, the week, the month or the year, so they restrict the times when a specific logic can be run.

Time events and Time Frame Conditions

In Apilio, we have two ways for you to set up your time conditions:

Time Event Conditions (:zap: always triggers)

  • Some day(s) at - example: Mondays at 10AM
  • At Sunset
  • At Sunrise
  • Advanced setup with cron*

Time Frame Conditions (either :eye: just observed or :zap: a trigger )

  • It’s a day - example: it’s Saturday or Sunday
  • It’s between time and time - example: it’s between 10AM and 11AM
  • Advanced setup with cron*

If a Condition is a trigger, it will launch the evaluation of your Logicblock: if you have a list of Conditions, all of them will be checked to see if it is ok to run the actions then.

How to set up a Time Condition in Apilio with examples

Head over to your Condition section in Apilio https://app.apilio.com/conditions. There you’ll be able to choose between a new Time Event Condition or a Time Frame Condition depending on what you need. A couple of examples:

:zap: “At sunrise” condition

You’ll need to set up your location first, Apilio will guide you to the setup page so you can enter your location on the map. We’ll use this to calculate your sunset and sunrise times.

:eye: “Between X and Y times” Condition

You can specify a time frame between two times of the day. You can also specify timeframes that happen overnight if you need to.

:zap: “Between X and Y times” Condition, but make it a trigger

In Apilio you have the power to transform your Time Frame Conditions into triggering Conditions. When this option is enabled, every time the Condition changes from true to false or from false to true, it will trigger the evaluation of the Logicblock, and the full list of Conditions will be checked to see if it’s time to run the actions.

This option is enabled by default as this works for most routines.

For example, the Condition “between 10h and 22h”, if used it as a triggering Condition, would evaluate its Logicblock at 10h and at 22h. Of course, as long as it is between those two hours, the Condition would remain true and could be checked if the logicblock is evaluated by other triggers.

* Advanced setup with cron expressions

Both time frames and time events can also be configured using cron expressions. This is very powerful and flexible! We have a detailed article that explains what these are and how to set them up here. It also explains what a cron expression is if you are just getting started with these. :wink:

:bulb: Related articles

3 Likes

Amazing new functionality @Dev Team, thank you so much! DanT

1 Like