[SOLVED] Cron Ausdruck falsch

Please help:
the cron expression does not work:
“0 0/15 * * * 1-5” or “0 0/15 * * * MON-FRI”

I want every 15 minutes Monday - Friday.

“0 0/15 * * *?” is working.

Here’s a link to help, I keep it in my toolbar menu.https://www.freeformatter.com/cron-expression-generator-quartz.html

The quick answer is “0 0/15 * ? * MON-FRI *”

I’ve already tried that, but the weekdays are not supported

Not supported where?


Change the - between MON and FRI to a comma if OH rules throws an error.

2018-10-17 21:06:36.995 [ERROR] [e.internal.engine.RuleTriggerManager] - Cannot create timer for rule 'Schaltuhr WZ Mo-Fr': CronExpression ' (0 0/1 * ? * MON-FRI *)' is invalid.``

Use MON,FRI not MON-FRI. also need the " " on each end.

Example of a rule I use.

rule "Smart Plug ON"

    Time cron "0 15 07 ? * MON,TUE,WED,THU,FRI *"

rule "Smart Plug OFF"

    Time cron "0 30 18 ? * MON,TUE,WED,THU,FRI *"    // OFF at 6:30 Mon-Fri

Unfortunately not

018-10-17 21:23:41.018 [ERROR] [e.internal.engine.RuleTriggerManager] - Cannot create timer for rule 'Schaltuhr WZ Mo-Fr': CronExpression ' 0 0/1 * ? * MON, TUE, WED, THU, FRI *' is invalid.``

It takes a little longer until I answer:
If I change the rule with VS code, it unfortunately takes several minutes until the error comes.

No spaces. Just MON,TUE,WED…etc

Also the cron in the error will run every minuet, I assume your just testing and know this.:wink:

Thanks, that’s it, although in all instructions MON-FRI is and nothing from the last “*”.
My timer should only query the cron for testing every minute, otherwise every 15 minutes.

Thinking back, I believe, I had the same issue with MON-FRI.:thinking:

Glad to see you got it working, please mark the post that resolved your issue by click on the square box.


Do you also work with VS Code?
In case of rule changes, it takes several minutes to log in the “Refreshing model ‘Thermostat.rules’”
appears and another 2-3 minutes until the rule works.
The rule has about 200 lines.
Is that normal?

I do use VSCode but most of my rules are 100 lines or less and I haven’t noticed anything near a 2-3 min wait.

Ok, thank you.