Caseta switch Fan + rule for specific reasons: BIG FLAW

C5 - Firmware

I hooked a bathroom fan to cool my computer room. This fan is located in my basement where the temperature is lower than any room, at any season. The air is extracted from there and blowed in my computer room (upstairs). This fan is managed with a specific caseta switch (4 modes).

My wife is very sensitive to noises and hear the fan (except in low mode) while "sleeping". During the day, we don't care about the noise (very low: 0.8 sone unit).

I created a rule that:

  • check the changing temperature of the sensor inside the computer room
  • set the fan speed depending of the temperature gap (between the garage and the computer room)
  • avoid fan speed higher than "low" at night, wathever the temperature gap
  • stop the fan if the computer room temperature is below 22 Celsius (72F)
    -check that the garage temperature (for any reason) is not higher than the computer room (to avoid blowing hot air in this room)

I will manage (in another rule) to stop some machines (NAS/Computers/switches) if the absolute temperature is going too high, to protect my hardware.

EDIT: While reviewing my rule, I noticed a big flaw here. If the temperature of my computer room is (example) 30 Celsius, all the rules are valid => my switch will go crazy by going to low to high, again and again...

EDIT 2: I think I have to define absolute temperature values to trigger the fan speed...

EDIT 3: Instead of absolute temperature, I'll set 4 local variables to define precisely the temperature range of each speed setting.

So, it's not done correctly and my question is:
How can create a rule that will keep the right speed and ignore the others ?

Instead of multiple IF/END-IF statements, you should use


This way only the first IF statement that evaluates to TRUE will be executed.