How I can set a timer for my switch in a rule?

  • Platform information:
    • Hardware: QNAP TS-251
    • OS: Docker on QTS OS
    • Java Runtime Environment: embedded in the last docker image
    • openHAB version: openhab 3.1
  • Issue of the topic:

Hello everybody,

I created a rule with the UI to switch on my swimingpool pump and I would like to know if there is a feature to setup a timer in manner for example that after 2 hours switch off.
I know that I can create an other rule to tell to switch off, but it’s very uncomfortable
Many thanks for the help

In the item configuration, add metadata, then expiration timer.

1 Like

Thank you very much Adrian, I just modified the item configuration and now I will check if run as expected.

Hi Adrian,

I done the check and it seems run!
I only see a small delay to send the command; example I power on the pump at 11.00 and setup a timer on the metadata of 10 minutes but the pump switch off at 11:12. It’s right this delay?

Who knows. You can get unexpected effects with expire. It depends very much on the technology/binding your mystery pump is linked to.

Here’s how expire works; when any command or update arrives at your Item, the timer re-starts.
So, you command ON the timer begins.
Maybe once in awhile your pump reports status - “I’m running!” - the timer is reset and begins again. This part depends on your pump, it may extend times or prevent anything ever happening.

Expire is nice and easy to use, but is not the answer for every case.