1) Give a description of the problem
Not sure if a For Loop should be used in this piston or some other solution. If a For Loop is the correct tool, how do I configure it correctly so it runs 20 times and then stops, but also stops if the next condition is met?
2) What is the expected behavior?
- If Dryer door contact changes to open, then every 30 seconds for the next 10 minutes get Current Power of the Dryer.
- If Dryer power stays greater than 10W for 40 seconds, then set variable @isDryerRunning = true.
a. should this condition be an Else of condition #1? (sorry, I don’t have a proper understanding of the else function)
b. Ideally, this loop would stop if condition 2 is met - If @isDryerRunning = true, get Dryer power every 15 seconds.
- If @DryerHasFinished (in another piston) = true, set variable @isDryerRunning = false
3) What is happening/not happening?
It seems to run every 4 seconds or so. I think it has to do with the inital check not stopping once the condition is met (that makes it check every 15 seconds)??
4) Post a Green Snapshot of the piston![]()
5) Attach any logs (From ST IDE and by turning logging level to Full)
I will post logs here after I get some initial feedback
.
EDIT: Question has been solved with a big thanks to @Mike1616, who spent a lot of time educating and helping me understand, offering an alternate solution.
As a noob, the settings required for a For Loop were not obvious. For others new to this, as a general example, these settings in a For Loop, will make an action run 10 times;
and will result in the code like this;

Through my experimentation I tried to add a Time variable, and this is the solution I ended up using;










I’m joking a bit there…you’ve got a good framework from which to start…I’m just not a fan of the global variables and having it across four pistons. But if you’re going to have it across even more than one piston then you’re going to need globals to do it.






