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