Predicate use vs if statement performance question

In the following rule I have now written it both ways with a predicate and with an if in the actions as shown.

I have a question performance wise. I assume the version without the predicate would use less resources as it would not have to evaluate the predicate conditions everytime?

I need the trigger so that I can show the value of the temp in the actions.

Thanks in advance. @bravenel

If the Predicate is based on a device that is also a trigger device, it will evaluate the Predicate condition after it has triggered the rule to run, basing the logic of whether to run on the prior state of the Predicate truth. I don't think a measurable amount of resources are involved in a case like what you showed. As the rule stands, it has to evaluate the trigger 'condition' of > 104, then evaluate the IF-THEN conditions. So it's pretty much a wash.

thanks .. what about the time.. how does a time predicate work.. does it have to re-eval it every minute? Sorry that was stupid question ... i imagine it sets a scheduled job to set it to true on the start of the period and another to set it false on the end.

Yep. And when false, nothing happens at all, no triggers. It just waits for that scheduled event to come back to life. I've got one with two dates. So for 5 months it will sit there doing absolutely nothing, waiting....

2 Likes

I am piggybacking on this thread as it's a similar question. My trigger is that it's 10pm. My action is to notify "something is on or open that shouldn't be" (unspecified) in time for us to check what it is in the dashboard and turn it off before bed.

I have used the list of things that are not meant to be on being on (any) as the predicate. How often is this evaluated? Just at 10pm each day?

Predicate conditions are evaluated every time one of the elements changes. Triggers are evaluated only when the corresponding event happens. You can look at Event Subscriptions and Scheduled Jobs on the App Status page (gear icon) to get some idea of what things are going to awaken the rule for evaluation. There is no form of polling taking place.

1 Like

Thanks. In that case I think in this particular context it would be more efficient for me to put these checks as conditions and have the entire thing only awoken once a day.