Logicblock self-evaluation

From a user: “Any chance LogicBlocks will evaluate themselves in the future instead of having to use IFTTT to call the evaluation every hour?”

They do don’t they? I don’t call my logicblocks every hour and they work just fine?

Take a look to advanced options of logicblock…

I may be wrong but I think the user is asking for a logicblock routine to trigger a self-evaluation according to a schedule, say every 5 mins.

2 Likes

Hi @DanT,

I do not see any business case for a time-based evaluation if you can re-evaluate automatically at each variable value change…

The only thing that I see is if you have a condition based on a timing like “myvariable is true since 5 mins” ; in that case a self-evaluation of linked logicblocks at the end of the 5 min delay would be great (but I think it’s covered in another community topic)

2 Likes

Hi @BOS!

We now cover the case you describe, you can make a condition a trigger when it changes (false to true and true to false). All the details here:

And for anyone who is interested in evaluating a Logicblock with a regular time schedule, you can use Apilio’s native time conditions, you might be interested in our cron expressions for an extremely accurate control! Have a look at our documentation regarding timing and time control to find what best suits your logic:

Hi Anna,

I have gone through the given details you mentioned above but am still unable to understand how any Logicblock will self-evaluate.

Let me explain what I want:

  1. I want when I am away, my tuya lights on and off at a random time - that I have achieved it after selecting the RANDOM delay option in actions.
  2. I created an IFTTT applet with date/time, which evaluates every hour and checks if my Is_Away variable is true, then it will evaluate the Logicblock else skip.
  3. When I return home, the Is_away variable is set to false, and Logicblock will be skipped by IFTTT when it checks every hour.
  4. This is the thing I don’t like, running IFTTT every hour! I need a way in Apilio so that the Logicblock only runs when the Is_away variable is true until it is set to False again. This means logic block starts evaluating when I am away and stops when I get back home
1 Like

Hi @saurabhtyagi2507

first, if you wanted to continue using a scheduled trigger, I would recommend to use the built-in time conditions, as describe here: How to setup and use time conditions

But as you already mentioned, you can do this even better without a scheduled trigger.
You can mark the condition to trigger an evaluation when the condition changes (i.e. is_away becomes true). Here’s an overview of all methods:

2 Likes

Thanks @pebneter for the sharing the article.

I managed to create the self-evaluating logic-block without IFTTT.
So this is how it works -

The logic block gets triggered when the Is_Away Boolean variable turns true. Inside the logic block, under the action, I have added the last action to re-evaluate the same logic block via webhook.
So it will keep running in the loop until the Is_Away variable sets to False again.

Thanks again
Saurabh

1 Like

You don’t need to create a loop. When the boolean of “is_away” is set to false, the condition result will change and this will trigger the logicblock evaluation again. Just this time, the result will be negative, so you can specify other actions.

1 Like

Why I have created the loop is because the duration I am away, my lights will keep turning on and off randomly. If I dont set it to loop, how will the action run again once they are completed?

1 Like

Ok, I see. I didn’t read the point about the random on/off properly.
How often do you want to switch on/off? What you could do is having multiple on/off actions in one action chain, but it might not be enough depending on the use case.

1 Like

Thanks for the response. I have 10 lights to be randomly on and off with random delay from 5 to 25 mins, all are in action under logicblock.
There might be a case where I am out for more than 10 hours so in that case one logicblock evaluation is not enough hence I set up self evaluation in the last.
Evaluation will stop when I come home as Is_away set to False.

Thanks
Saurabh

3 Likes

Super-good use case, thank you for sharing!

1 Like