Is there a limit how long an While loop stays active?

Hey everyone,

I have an automation Wich sets a limit via Mqtt every 15 second’s (longer periods tried allredy) for my Solarpanel. Based on the energy consumption of my house. It works fine, and I testet a lot but, it seems like from time to time it stops working for no reason. The Automation gets triggered every day at sunrise. Then it stays in the while loop where it changes the values.

I have the feeling that the while loop could be the problem because it stays active for so long. Is there a know limit of how long a while loop can stay active?

Thank you for the help !

There is no limit but this is not a good way to write an automation. It will be interrupted every time you reload the automation or restart home assistant.

Instead, trigger whenever your house load changes. If you need to rate limit this you can do it with a condition.