ODD && Rule Behavior

  • Platform information:
    • Hardware: Raspberry Pi 4 4GB Ram
    • openHAB version: latest version of openhabian

I have a rule to turn on a fan if several conditions are true, it worked flawlessly but I was having an issue where the fan would turn off once the conditions were out of their respective ranges and within a relatively short period of time (anywhere from 5-20 minutes) the conditions would be true again and the fan would turn back on. It is a rather large fan so that didn’t give everything sufficient time to cool off(motor heater, reset) so then the reset would kick out and I would have to go manually reset it. To combat this problem I created a Lockout switch item with an expiration timer and a simple rule so that when the fan state changed from ON to OFF the lockout would turn on and expire in XX amount of minutes. I added the lockout switch to the rule as a condition that had to be false in order for the fan to turn on, it shows that the lockout is OFF in VSC, but with the lockout in the rule, the fan will not turn on… As soon as I delete the lockout out of the rule it functions normally. I am very much a beginner with openhab so I may be missing something, but in my mind, this should be working, although I’m sure there are more efficient ways to do it that I am not aware of yet.

    if (BigStorageAuto.state == ON && BigStorageLockout == OFF && emc > BigStorageBinMinEMC.state as Number && emc < BigStorageBinMaxEMC.state as Number && temp > BigStorageBinMinTemp.state as Number && temp < BigStorageMaxTemp.state as Number) //check to see if the fan needs to turn on
    BigStorageBin_Relay.sendCommand(ON)//Turn fan on

Spot the difference

:man_facepalming: :man_facepalming: :man_facepalming: :man_facepalming: :man_facepalming: :man_facepalming: :man_facepalming: :man_facepalming: :man_facepalming: :man_facepalming: :man_facepalming: :man_facepalming: :man_facepalming: :man_facepalming: :man_facepalming: :man_facepalming:

I have been staring at this code for hours and did not catch that… I am sorry for the stupid post!

Do not be ashamed … I have learned to look, by way of falling in the same trap many times.