Rules running at the same time

Hi guys, just a question. What is the effect on the hub if 5 rules have the same trigger. Will the hub be able to execute each rule if the trigger becomes True. So can 5 rules execute at once, will the hub queue the rules up?

So basically, when my kitchen skylights open, I want 5 of my heating thermostats to turn off. Theres a bit more elaborate logic but this is the basic principle?

I would think in principle yes, they should be able to run, but performance may depend on what you try to do inside the rules. I guess one question would be why they need to be split out? Could they not be combined?

2 Likes

Combine them using a group and apply the rule to the group

1 Like

It's pretty complicated, there are sort of rules within rules and different delayed actions. If I combined them, the cancel delaytd actions would cancel sections which I don't want to cancel. I'll figure it out :+1:

1 Like

I had a bunch of rules that did 3 things when doors opened/closed. They kept sort of running into each other and not completing. I split each rule into 3 rules all triggered by the door open/close events as appropriate and my system is a lot more stable and things are occurring without any hiccups. I recommended sampling your rules based on my experience,

Alan

It is my understanding that the difference in performance between splitting out rules or making one monolithic one is negligible. That is what i have read in the past with similar discussions. I would simply ask is there a fundamental reason for them to function together. If not then leaving them seperated should not hurt anything. Generally the argument for separating them out is for ease of upkeep and to make changes.

My take away is performance is more about what they are doing in general and now about if they are combined or not.

Just in case none of the above directly answered this part of your question, the rules won't "queue" in the sense of one waiting for the previous to finish before starting. They will all execute at more or less the same time and, therefore, run their actions at more or less the same time. What may differ between each execution is the exact order in which the rules are triggered (which one happens a few millseconds before or after another isn't guaranteed to be consistent, so again for all practical purposes I'd consider them simultaneous).

It's not clear if your question is coming from a perspective of wondering whether they will indeed all execute (yes) or if this might impact performance versus one rule (I agree with the above that this isn't likely to matter in real-world scenarios; you can look at Runtime Stats if you want some objectivity). One concern that may matter, however, is if any of the rule actions might "conflict" with one another, like setting a hub variable or sending a command to a device in an attempt to manipulate its state, particularly if one of the other rules depends on one of these actions having already completed. Since, again, without additional effort, the order of execution of actions (among all the rules, not within a rule--where they are, of course, ordered) is not defined, that's the biggest thing I can think of that could cause problems--but, again, that's only a concern if this matters for what you're actually doing with the rules.

1 Like

I wonder if this might be a good use case for the Predicate conditions? Have you thought of using those to help narrow down what runs and when?

So for example, if a thermostat is already off, the rule doesn't run. Or some other condition depending upon what else is in this rule.

1 Like