Might you try to use a cron trigger instead to determine the date? Here’s how I remind myself that the trash needs to go out. I use this notification item with the informational-header widget in HABPanel.
rule "Setting Trash Day State"
when
// Run this rule at 9am on Wed and Thur
Time cron "0 0 9 ? * WED,THU"
// Time cron "0 10 18 ? * *"
then
// What day of the week is it
val dow = now.getDayOfWeek
logInfo("HouseStates", "Today is :" + dow)
// Trash day is on Thursday (4), set reminder a day early Wednesday (3)
if(dow == 3) {
logInfo("HouseStates", "Setting Trash Day State ON")
TrashDay.sendCommand(ON)
notification_trash_day.sendCommand(ON)
} else {
// When day of week is != 3 it must be Thursday. Trash is picked up by 9am so turn off Notification
logInfo("HouseStates", "Setting Trash Day State OFF")
TrashDay.sendCommand(OFF)
notification_trash_day.sendCommand(OFF)
}
end
You can’t compare dates with an = sign. The datetime object also includes the time down to the millisecond, I believe. You would have to be incredibly lucky to get them equal.
You could try to extract the date and a string for each object in 2 string variable and compare those.
In my case, I use the caldav binding with google calendar.
Scheduling for openHAB is a hot topic and is planned for a future update.
The devs are aware that this is a very often requested feature.