i want to achieve the following: when turning a switch on in HABpanel, i want to make sure it turn itself automatically off after a period of 15 minutes. It should also be possible to turn it off manuall within that period. And when turning the switch back on, timer should start form the beginning.
Background: i’m switching a simple valve for watering in the garden, however i forget sometimes to switch it off and too much water gets into the ground. Therefore it woul be great to have this feature in OH.
Every hint to achieve this is highly appreciated.
what it does is simply sending the “OFF” command after 15min, if the item is ON. It resets after the item receives another “ON” command, meaning the timer is set anew to 15min - and it is deactivated if you switch it “OFF” before 15min ends.
I don’t think so. expire is legacy OH1-binding and AFAIR, in PaperUI doesn’t let you add those stuff…
You have two choices, which come into my mind:
use a items-file for only the switches you need to expire
use a rule for that
ad 1)
just delete the item from PaperUI and make a item-file, which includes the expire-stuff
ad 2)
use a rule for that (again, this will be the “old” DSL rule file):
rule "shut off water pump"
when
Item "YOURWATERPUMPITEM" changed
then
if (YOURWATERPUMPITEM.state === ON) {
// if water pump is started, set the timer for 15min
if(tWaterPump !== null) {
// if Timer is already running - cancel it
tWaterPump.cancel
}
tWaterPump= createTimer(now.plusMinutes(15), [|
// after 15 min: shut off Waterpump
YOURWATERPUMPTITEM.sendCommand(OFF)
])
} else if (YOURWATERPUMPITEM.state === OFF) {
// if waterpump is shut off - cancel the timer (this should be triggered either when you manually switch it off or if the above timer switches it off
tWaterPump.cancel()
}
end