Global variables or a similar function?

My current grow room setup has a small anti room that is cooled and than pumps the cool air into a grow room. I have a few functions setup, one is to control the temp inside the grow room. This regulates temp: IF temp >24 fan on else if <22 fan off. The other is a timer duration, which turns the fan on 20 min every 4 hours. This is to cycle fresh air in.

What currently happens is if temp is below 22 then it wont allow the timer duration function to work, i need to cycle air regardless if the temp is below my desired set point.

Is there a way to use like a global variable that i could use to tell one function that another functions if statement is true? Read through a lot of the documentation, but dont seem to find what i require. Any help i how would go about this would be great.

I am assuming your fan control function is a Conditional Controller. So you have:

  1. Conditional Controller - Turn fan on or off based on temperature
  2. Duration Timer - Every 4 hours: Turn fan on for 20 minutes

What immediately comes to mind is deactivating the Conditional Controller for the 20 minute duration the fan is on so that it doesn’t turn it off prematurely, then activating it once the 20 minutes is over. There are a number of ways to do this, but here is one such setup:

  1. Conditional Controller - Turn fan on or off based on temperature
  2. Duration Timer 1 - Period: 1 hour, Start Offset: 20 minutes
    a. Action: Activate Conditional Controller
    b. Action: Deactivate Duration Timer 1
  3. Duration Timer 2 - Period: 4 hours
    a. Action: Deactivate Conditional Controller
    b. Action: Turn fan on for 20 minutes
    c. Action: Activate Duration Timer 1

What this does is deactivate the Conditional Controller so it doesn’t turn the fan off, and activate a second Duration Timer that won’t execute its Actions until 20 minutes have passed, at which time it will activate the Conditional Controller and deactivate itself.