I have an issue with my Conditional Controller: when I analyse the logs, I have some times unexpected “Refreshing conditional settings” which relaunch the class object and so run again the class init method, which is catastrophic.
You are pressing “Save” for that Conditional Controller. There is no other way to use the new settings without restarting the controller thread with the new settings you just saved.
Sure, I have a conditional controllers with states as self.loop_count in your example, in particular a counter for watering. When I enable the controller, it loops on this counter.
But for unknown reason, the init method of the class is runned again in the middle of the execution of the run method.
Sure, but it looks very tricky. I have loaded the last 100,000 lines of log ang grep -i -C 4 refreshing logfile to figure out where it happens, but actually it happens any time, there is no pattern.
That wouldn’t cause the behavior. The only thing in the code that calls a conditional refresh is pressing “Save” while it’s running. You may just not remember pressing save, but you can see that if you press save, you’ll see that log line appear.