I currently use this rule to start the fans at my rack when it goes over a certain temperature.
rule "Rackfan power to ON at 1200hr"
when
Time cron "0 0 12 ? * Mon-Sun *" or
Item PS3Powerstrip22URack_Temperature received update
then
if ((PS3Powerstrip22URack_Temperature.state > 40) && now.getHourOfDay() >=13 && now.getHourOfDay() <=18) {
Rackfan_Power.sendCommand(ON)
sendTelegram("bot1", "Rackfan is switched ON as rack temperature is above 40°C" )
logInfo("Info","Rackfan power ON Rule fired")
}
else if ((PS3Powerstrip22URack_Temperature.state < 40) && now.getHourOfDay() >=13 && now.getHourOfDay() <=18) {
Rackfan_Power.sendCommand(OFF)
logInfo("Info","Rackfan power OFF Rule fired")
}
end
How do I change it that it only turns off at least 10 minutes after it detects the temperature falling below the threshold, and to fire the rule again only after at least 1 hour after it detects the temperature change (to stop spamming me with messages)
Here is a rule example which compares two times to make a simple decision similar to your use case. It might get you started. Ask more questions as your go and we’ll get this working!