The idea is to slowly increase the brightness of the lamp over a period of 30 minutes. My original code, that worked in OH 3.x, was based upon a “Repeat-while” loop that would have delay of few seconds between each repeat. I read somewhere that using “wait” inside the loop is not recommended. Therefore I ended up with this structure whre the “repeat while” loop wraps around a delay timer.
I am not a coder so I do not quite understand what “this creates the same time three times” means in this context. Please explain.
Ok, understood. What you must not do is to stay in a rule for 30min. Therefore you need to increase the value via a timer, which is the reoccurring way that replaces you loop. In that timer you use a value that is stored in a shared rule cache variable:
Retrieve it, increase it, use and then save it again in that “stored value”.
Here is an example that use it to remember the last color that was set
In you example you can use it similarly only that additionally also increase the value.
Thanks for the help. I ditched the loops totally and rewrote the wakeuplight. Now it runs once, stores its states in value storages and exits. The script is run once a minute until it has completed the wakeup cycle.