Hi All,
I am struggling with rules with timers I am note sure the best way to handle it. I have one for my pool filter pressure sensor rule it turns the pump off if the pressure drops to low or goes to high. The problem is I need it to wait 30 seconds for the pressure to come up after turning on I have tried. sleep and timers here is what sometime works
import org.openhab.model.script.actions.*
rule “Pool_ Filter”
when
Item pool_filter_preasure changed
then
habpcmd.sendCommand(“SCREEN_ON”)
Thread::sleep(29000)
if (pump.state == ON && pool_filter_preasure.state > 270) {
pushNotification(“Information”, “Filter Preasure High!”)
pump.sendCommand(OFF)
}
else if (pump.state == ON && pool_filter_preasure.state < 170) {
pushNotification(“Information”, “Filter Preasure Low!”)
pump.sendCommand(OFF)
}
end
The other one is a water level sensor I would like it to check 3 times before shutting pump off I have tried timers and setting a switch but still no luck
import org.openhab.model.script.actions.Timer
var Timer delayTimer = null
rule “Pond_Level”
when
Item Pond_Level received update
then
{
if (Pond_L.state==OFF) {
if (Pond_Level.state > 25) {
logInfo(“FILE”, “Pond Low”)
pushNotification(“Information”, “Pond Water Low!”)
pond.sendCommand(OFF)
Pond_L.sendCommand(ON)
}
}
if (delayTimer === null) {
delayTimer = createTimer(now.plusMinutes(60)) [|
logInfo(“FILE”, “Timer Pond expired and setting to OFF”)
Pond_L.sendCommand(OFF)
delayTimer = null
]
}
}
end
Thanks all if you have any ideas it would be great.