Multiple when statements causing rule not to fire

Hi all,

I have a strange issue which only started when I migrated from OH1 to OH2, using rules to control the on off times of multiple lights and have when statements which are set to turn the lights on at different times throughout the year so in winter the lights come on earlier than spring then summer and so on.
Since moving to OH2 when I have a rule which has more than one definition with an “or” statement the rule wont fire if I comment out all but one option the rule works and I cant figure out why.

Heres an example of a simple rule I use to control a salt lamp in my study, if i have both “Time cron” statements enabled the rules stops firing and I dont see any events for it even with debug enabled for “smarthome.event” but if I comment out the first “Time cron” entry (or mcomment out the second and remove the “or” part) it fires fine; if I split the one rule into two separate ones it works fine.
In OH1 these more complex rules worked fine.

//Study Salt Lamp
//
rule "Salt Lamp Time On Study"
when
Time cron “0 0 8 ? JAN-MAR,OCT-DEC MON-FRI” or <<-------
Time cron “0 30 8 ? APR-SEP MON-FRI” <<-------
then
val current_state = HolidayMode.previousState().state
if (current_state == OFF) {
logInfo(“Rule Test”, “Turning Salt Lamp ON”)
sendCommand(SF_ST_ZW_Socket_1, ON)
}
end

Any help would be appreciated as I dont really want to create lots of rules to do what OH1 did without issue.

Kevin

Unfortunately a known issue and not yet solved:

Hi,

Thanks for the info, given it’s an automation system time based rules seems like a bit of a key feature not to be working, well complexed versions of.

At least thats my opinion :slight_smile:

Kevin

1 Like

Ask for your money back

1 Like

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.