I have an automation that uses a repeat until loop to dim a light until the state changes to off. It has been working well for many months. A few nights ago, the automation started failing. When I watch in the light’s app, I see about 8-10 decreases and then the automation stops.
When I watch on the automation screen, I see “action run successfully”.
Unfortunately the light is still on and the state of the light is still “on” so I can’t figure out why the loop has suddenly started exiting before the state of the light changes.
I tried a slightly different loop that fails similarly. Repeat until brightness is less than 1.
Previously successful loop that has started failing
doing this i a tight loop i typically meta stable. this is because the call to change the brightness on a light is typically not synchronous (ie, it’ll return before the ligtht actually changes brightness)… and it might or might not queue up your requests. if it does queue up the request, what will it do when you’ve overloaded the queue?
it’s not uncommon for this tight loop approach to work for a while, then when timings change (due to an update, or other things happening) it may suddenly break.
the best way to do this is if your light natively supports transitions…
And @RN-Say, if you were to give my light-fader script a go, and if you were to have any questions about it, feel free to ask and I’ll be happy to chime in!