Quick question, running the latest Openhab version on a Raspberry Pi 3+.
Trying to create a rule the controls my waterpump,. So the logic is: When Pump is started, i want it to run for 10 seconds to build up pressure, if the effect (200w) is below a certain limit after the 10 seconds it should shutdown (no water in the well so the pump is running dry, low effect). If above then it should run until the effect goes below a limit (200w).
What i have so far:
rule "Pump off grund"
when
Item Z_Node017_Switch changed
then
if(Z_Node017_Switch.state == ON)
logInfo("notifications", "Pump well on")
{
createTimer(now.plusSeconds(10), [
logInfo("notifications", "Timer on")
val effect1 = Z_Node017_SensorPower.state as DecimalType
logInfo("test", "PowerSensor: " + effect1)
if(Z_Node017_SensorPower.state <200)
{
Z_Node017_Switch.sendCommand(OFF)
}
])
}
end
My problem is that efter 10 seconds it checks the effect and shutdown, all good so far. But if the pump effect is above 200 and runs for 2 minutes, how can it be shutdown then. Right know it only check once after 10s, i need some sort of loop or something if power is above 200w?
How about triggering a rule from any power level change. The rule will need to check if we are in the start-up phase (look for the timer existing). If not, and if power < 200w, shut down.
You’d need to put your timer in a global variable so that another rule can get hold of it.
Thanks, that was my initial though also. In my brain it was a bit “messy” having several rules for one case, now im a NOB at this so it might just be wrong thinking from my side.
Maybe another rule is the way, how can i make i timer global and how to access it, the time above i just found from an example so i dont really understand how they work.