[Released] Rule Machine 3.0

split this topic #266

16 posts were split to a new topic: How does Repeat Actions work


A Repeat Actions works by running the same action for each repetition, starting with the Repeat Actions action. For a Simple Conditional Action, the condition is part of that action, so it is tested on each repetition. If it is true, execution continues. If it is false, the actions until End Repetition are skipped.

In contrast to that, IF-THEN is it's own action, and a Repeat Actions after that is a simple Repeat Actions, with no condition attached.

Simple Conditional Actions attach the condition to an action. You can see this when you create one, in the way the UI prompts you. You can see it in the result, where the condition is on the same line as the action. You can read about it in the documentation: Rule Machine - Hubitat Documentation.


Sorry for such a basic question, but I’m missing how to do delayed off in RM 3.0 like the 2.5 example here.


Exactly the same way. The Delay is attached to the Switch Off action.


So if my action for True is switch on, true should also continue off with a delay?



thanks for the explanation i can see it now. So would this work?

if in party turn on and whilst its ON repeat.

Aw is this what a nested IF is? So no?


I find the new IF THEN functionality extremely useful, thanks for bringing this to us!

However, I have now quickly found that it would also be really helpful to be able to nest these. Are there any plans for adding support for nested IF THENs in the future?


Not any time soon.


So if my example is a nest then this should be a work around


Speaking of IF THEN, I found what I think is a bug yesterday with inserting a new IF THEN before another IF THEN in a rule.

Consider this rule:

Then try to change this rule so that the first action is inside its own IF THEN. Inserting the IF THEN before the action is working as it should:


But, I now cannot insert the END IF. The option is not there:


The way around this is to first delete the existing ENDIF, then I can insert the first ENDIF, followed by the second ENDIF:


Don't worry about what this rule does. I just used some random actions to cobble together an example that would illustrate the bug.


@bravenel I just found the same thing with my rule i moved the IF to the top and i couldn't add a END IF until i deleted the other one at the bottom.


I don't understand this at all. If party mode is false, you are setting it to true, then you have another if looking at whether party mode is true or not. That doesn't make any sense.

I assume you have some other function to change the variable of partymode back to false at some point? Otherwise it's going to repeat forever.

Also, why would you turn on your chandelier to 100% if you are going to be away? I don't get that either.


As soon as you did that you created a nested IF THEN. Those are disallowed. Now you can see one reason why.


So should you not then prohibit inserting IF THEN in to a rule that already contains one IF THEN? Otherwise you will potentially end up with a nested one (even though you didn’t want one, like me and @BorrisTheCat ) as you cannot insert the required ENDIF.


It's very difficult to completely police what you do with editing the actions. This isn't a compiler that is checking the entire list of actions for everything to be right. We do prohibit you from entering and IF-THEN once you've put one in, after it. But the effort to do what you're suggesting is beyond the scope of what is implemented. Just follow the documentation.


this is the UI its if IN party mode turn ON light and set variable to true. Then the simple condition does the repeat as long as that variable is true.

the false part of the main condition does that

this comes from the ST days when presence was very flaky and the house used to change when i didn't want it to. Then the switch stopped working. Although i could now remove this its in there so that no matter the mode the manual switch will always work.

anyway it doesn't matter because it works perfectly !


In my set up it was a if then , end IF then another If then for another condition then end if, which is not nested though, but it still didn't let me do a end if. But again this might just be because i was using insert action before and maybe it was blocking me because it thought i was trying to nest them?


It's sensitive to context to some extent. Editing actions like this is much simpler if you just delete the action you want to change, and then put it back in where it goes. Or, better yet, write the actions down first and put them in with the right order.


Does this fall into the "measure twice, cut once" rule of thumb? :smiley: