How do I set the cooling fan to be turned on or off depending on the temperature in the Function-Conditional Controllers?

In the Function-Conditional Controllers, if the temperature is above 27 degrees, the cooling fan is activated, and if the temperature is below 23 degrees, the cooling fan is not activated. But It will continue to operate below 23 degrees. How do I set it up?


You’d need to set Off action, currently if meas < 23 you have self.run_all_actions, instead of the proper Off one.

I set it below 23 degrees, but the cooling fan keeps on turning on


First, your Max Age is 10 seconds, which is very low. If anything, you want this value to be high. Are you even sure you’re getting measurements with a Max Age so low? Use logging to see if you’re having measurements returned. If no measurements are returned, you can’t compare them to integers like you are showing in your code.

What is Max Age responsible for in functions? And what range do you think should it be in?

Thanks in advance.

1 Like

Max Age is the number of second in the past to look for a measurement. E.g. if set to 120 seconds, only measurements in the past 120 seconds will be queried. If a measurement is not found within this period, None is returned (and the function querying the measurement simply doesn’t function). This prevents a function from using too old data, such as when an Input or sensor stops working.

1 Like