Rule vs Triggered Rule (efficiency question)

In theory, would a triggered rule be less of a strain on the hub than a regular rule in RM? For example, I have a rule that turns on a light if a door is opened and then off after a 5-minute delay when the door is closed. Right now it's set up as a typical rule. I could change it to a triggered rule, and have the door opening as the trigger. Would this mean the hub wouldn't constantly have to be evaluating whether the rule is true or false? I feel like they would both essentially function the same way, but I'm wondering if one would be more efficient. Thanks in advance to anyone who can offer some insight.

1 Like

First, a condition or normal rule isn't constantly evaluated. It's event driven. When you have a rule with a condition of Door Open, it only does something when the state of the door changes. So when the door opens, the rule changes to true. Nothing else happens until the door closes, at which point the rule changes to false.

On top of that, rules and triggered rules are really different use cases. Rules with conditions subscribe to every device in the conditions. Triggered rules subscribe only to the trigger devices. Take these two examples:

Rule: Door Open AND Switch On
Subscribes to Door and Switch. A change in either device state will cause the rule to be evaluated. Actions are run depending on the combined truth of both conditions.

Triggered rule:
Trigger: Door changes to Open
Rule: Switch is On
This subscribes only to the door. If the door changes state, the rule will be evaluated and actions run depending on whether or not the switch is on. If the switch changes state, the rule is not evaluated, as it's not subscribed to the switch, so nothing happens.

One isn't really more efficient than the other...again, event driven, not constantly evaluated.

In the two examples you gave, you would get different results. The rule would wait until the door is closed, then start a 5 minute timer. The triggered rule would start a 5 minute timer as soon as the door changed to open, as it wouldn't be "listening" for the door to close.

12 Likes

Makes perfect sense. Thanks for the clarification!

1 Like

Thank you for this concise explanation and example. I've been puzzling out the difference (quite poorly I might add!), and this made it crystal clear!

Scott

1 Like

Took me a while to work out the difference too.

Great explanation. Thank you!

1 Like

One area where I am seeing an issue with using a triggered rule is when I have an action in the FALSE section. I found out that the rule is checked only when the trigger event occurs. So, it made sense for me to set up as a rule.

One minor thing with defining something as a rule is that, when I save the rule, the FALSE section gets executed once.

Whenever you hit Done in a rule, it gets evaluated right then. This is so that it has an initial rule truth. Subsequently, only changes in rule truth after an evaluation caused by condition state changes cause actions.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.