[SOLVED] Cron expression in rules


Is it possible to make in rules in “when” space a cron expression like:

rule “xyz”
when between months june - august and betweend hours 12-15
then ‘do something’

Please help me. I will be gratefull. :slight_smile:

Yes that should be possible. I can’t find the site but there is a crib expression site that can help u. You can try google I am having no luck right now rememberinging.

1 Like

2 listed in the OH rules documentation are



Yes of course. I see the sites when I can generate cron expressions but it is only on specific time or for example every 5 minutes. I don’t see some examples with using tim between x and y.

I took the following from freemormatter.com:

0 0 12,13,14,15 ? JUN,JUL,AUG * *

Between Jun and August this is fired each days at 12pm, 1pm, 2pm, 3pm

Isn’t that what you want?
You need to specify an exact time for cron, you can’t tell to fire once sometimes between 12pm and 3pm.
For that you would in addition write a rule that performs this.


Thank You. Understood, I can use it :slight_smile:

@Bruce_Osborne thanks that’s the ones i was thinking of!

1 Like

It is amazing what pearls of wisdom are in the official documentation. :rofl:

1 Like