I setup a rule to kick off my Christmas automation on the 1st of December @ 2:00am but the rule did not fire. The “Christmas_Time” item in my rule below is a dummy switch that all of my other rules reference. If I turn this dummy switch on manually from my sitemap everything works great but I was hoping to automate the dummy switch turning on as well on the 1st of December @ 2:00am.
Running OpenHab 2.4.0 on Windows 10.
rule "December 1st"
when
Time cron "0 0 2 1 12 ? *"
then
if (Christmas_Time.state == OFF) {
sendCommand(Christmas_Time, ON)
logInfo("Switch Event", "LOG - December 1st, turning on Christmas Time Automation")
}
end
There is no issues with your cron expression so that should have triggered
Is is possible that your item was not OFF but UNDEF or NULL in which case the if statement woud have returned the rule without executing any code. Remove the if statement. it is not needed.
There are issues in your rules however
As Christmas_Time is a dummy item with no binding, there is no needd to sendCommand, a postUpdate will suffice
Also as the item is known, it is better to use the method instead of the action:
rule "December 1st"
when
Time cron "0 0 2 1 12 ? *"
then
Christmas_Time.postUpdate(ON)
logInfo("Switch Event", "LOG - December 1st, turning on Christmas Time Automation")
end