Scheduling actions (rules)

Hi All, very new user here, but very much love what i’ve found so far. I’m running OpenHAB 3.2 on Ubuntu 20.4.

I have a pretty simple rule I’d like to run, but I’m struggling and was wondering if anyone could advise on how to make this work.

Everything is been done via the gui, but I’m not afraid of code and learning if needed.

What i am trying to achieve is the following:

I have a switch defined as a point called DeadLegPump_Power, this basically turns on / off a water pump that circulates hot water round the house.

I’d like to run this pump from 6am to 10pm, in 15 minutes intervals, so at 5am it runs for 15 mins, then at 6:15am it powers off … then back on at 6:30am etc etc …

i’ve built the following rules, but as you will see an i discovered, this basically switches it on once and then its always off.

triggers:
  - id: "1"
    configuration:
      cronExpression: 0 0/30 6-22 * * ? *
    type: timer.GenericCronTrigger
conditions: []
actions:
  - inputs: {}
    id: "2"
    configuration:
      itemName: DeadLegPump_Power
      command: ON
    type: core.ItemCommandAction
triggers:
  - id: "1"
    configuration:
      cronExpression: 0 0/15 6-22 * * ? *
    type: timer.GenericCronTrigger
conditions: []
actions:
  - inputs: {}
    id: "2"
    configuration:
      itemName: DeadLegPump_Power
      command: OFF
    type: core.ItemCommandAction

Any pointers would be really appreciated, I’m guessing this could even be possibly done in a single rule using if statements ?

Thanks

/30 means your rule runs every 30 minutes.
/15 means your rule runs every 15 minutes.
This means every 30 minutes both rules are executed.

Did you try to create a comma separated list for the execution:

0 0,30 6-22 * * ? *
0 15,45 6-22 * * ? *

You only need one rule with the following cron expression (use the builder for creating it)

cronExpression: 0 0/30 6-22 * * ? *

Then you can ad a script to your rule with the following steps

  • Switch pump on
  • Start a 15 minute timer
  • Switch pump off at end of timer

I wasn’t aware (and still dont know) how to use comma separated lists … will go read up !
Thanks

Thanks for the reply, i’ll go read up on basic scripting 101!
Question, does blockley support creating timers ? or am i gonna have to do this through text files.
Cheers

see e.g. Cron Trigger Tutorial
Special characters that can be used like list, range, increment are explained there.