Multiple Cron expressions

Is it possible to have multiple cron expressions as a rule trigger? I want a rule that’s triggered every minute between 0645 and 0715, but I don’t think this will work:

when
  Time cron "0 0-15 7 * * ?" or
  Time cron "0 45-59 6 * * ?"
then

To be clear, the actual test I’m doing (so I don’t have to wait for tomorrow morning) is:

when
  Time cron "0/15 * * * * ?" or
  Time cron "0/20 * * * * ?"
then

in the above, it runs only every 15 seconds, not on 20 and 40 seconds. If I reverse the order, the rule triggers at 20, 40 and 60, but not the 15’s.

If I have to turn it into a single expression, can anyone advise how I do that? Just “0 0-15,45-59 6,7 * * ?” won’t work, because that will trigger at 0600-0615, 0645-0659, 0700-0715 and 0745-0759, which is not what I want.

It is supposed to be but there is currently a bug which is preventing them from working. Only the first expression triggers the rules.

I’m not sure of the status of the fix for this.

To work around it you can create a proxy Item and separate rules which call the proxy Item to trigger the rules. It’s not pretty but it will work for now.

1 Like

As @Schnicki was so kind to inform me here in my post of a similar question: It looks like it has not yet been resolved.

1 Like

Thanks both, I’ve an idea that I’d like to contribute to the project (I’m a Java developer by day), so maybe this is where I’ll start… :slight_smile: Maybe

This definately does not work.
I ran in to the problem yesterday, took me ages to find out (because I thought this was fixed). :frowning:

Does this issue affect all ORed rule conditions or just time cron conditions?

Just the CRON conditions combined via OR are affected.

@Jürgen: THX very much!

FYI this bug was fixed with: https://github.com/eclipse/smarthome/pull/3326
The fix is part of the latest openHAB snapshot builds and will be included in the next stable build.

If you are currently suffering from this bug, your options are (1) reduce your rule to one cron condition, (2) wait for the openHAB 2.1 stable release or (3) switch to the unstable branch and use the latest snapshot.

If you did one of the above and still encounter problems, they are probably unrelated to the bug discussed here. Please search the forum for similar cases or create a new thread.