@bravenel a while ago i wanted a conditional action repeat but I had set up wrong as i was told the actions IFs done get evaluated so esentaly it would run forever. So stop on truth change had to be the main conditions truth change correct?
but in the documentation it says this
A Repeat Actions, like any action, can have a condition specified. If the condition is false, the Repeat Actions block of actions will not be executed. If the condition becomes false during repetition, the repetition will be stopped (not in the case of Repeat a selected number of times). This provides three features well known to computer programmers; A while-loop, a for-loop and repeat-until loop. The while-loop runs only if the condition is true, and stops if it is false. A for-loop runs for a fixed number of times, but if a condition exists, it will only start that iteration if the condition is true; the condition is not retested during iteration. A repeat-until loop runs until a condition becomes true, running at least once.
While loop - repeat while the condition is true:
IF (condition) Repeat Actions
some actions...
End Repetition
which to me states otherwise that if the IF (condition) changes to false it stop. no mention having to tick stop on truth change eather. Is it that whatever the condition is it would have to also be a condition in the main part of the rule even if its not in the rule defined.
Right! ok that would be why. It's not clear what the difference is between them (currently reading the docs so it may become clear) what is the difference, is it one is evaluated all the time one not?
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.
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?
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.
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 !