Repeat loop exit

I'm away from my hubitat so can't trial this so hoping to get some feedback.

I have a repeat loop that iterates a variable each time it runs, with an embedded if statement in it that when the variable is over a target value it exits the rule.

I am now looking at making it exit just the repeat loop, and continue the rule lines below the end rep line.

I believe having an embedded if statement in the repeat loop, but with a stop repeating actions, also makes the rule end and not run the code below the repeat loop?

Could I put an embedded if statement that had a "end rep" action? Or would two end rep cause a problem?

I would suggest showing your current rule. But in general:

  • A "Stop Repeating Actions" will not stop running actions after that action that are outside the repeat--it just stops the repeat from looping
  • You can only have one END-REP (or, in other constructions, Until) per Repeat..., and it is not syntactically valid to "mix" this inside of an IF THEN ... END-IF (you'll see funny indentation in the editor if you try, which should give a clue that something is wrong).

The first thing alone sounds like it should solve your problem, so that's why I'm curious to see the rule. If it's not working as you expect, enabling logging and looking at those (or providing them here) may also be helpful.

3 Likes

Ok thanks for confirming this. I'll try this then as it seems that it will behave like what I had hoped, and exit the repeat loop that it's nested in. I read somewhere that contradicted this, which is why I wasnt sure it was the right thing but seems potentially I misread or that info was wrong..

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