Hello, after a longer time, I have another questions. First, my openhab rules are growing and growing.
Next, I want to create a rule, where:
at 19:00 every day I will run the rule, where the light will be switched on, but only when there is an event NEXT DAY, with a specific string in the calendar.
rule "kalendar-odpady"
//zasviet svetielko na xiaomi hube podla vyvozu smeti
when
Time cron "0 03 15 1/1 * ? *" //o 19stej
then
logInfo("kalendar-odpady", "je zajtra nejaky vyvoz odpadu?")
if(KalendarOdpady_NextEventTitle.state == "Kovy") {
sendBroadcastNotification("Vyvazaju kovy.", "sewerage", "WARN")
//+xiaomihub svetielko nacerveno
}
end
sofar it is working, but I dont know how to code the condition - NEXT DAY only.
This will be cool, my family will like it for sure
thanks,
Michal
val tomorrow = now.plusDays(1)
rule "kalendar-odpady"
//zasviet svetielko na xiaomi hube podla vyvozu smeti
when
Time cron "0 00 18 1/1 * ? *" //o 18:00
then
logInfo("kalendar-odpady", "je ZAJTRA nejaky vyvoz odpadu?")
if (KalendarOdpady_NextEventStart.year == tomorrow.year && KalendarOdpady_NextEventStart.month == tomorrow.month && KalendarOdpady_NextEventStart.dayOfMonth == tomorrow.dayOfMonth)
if (KalendarOdpady_NextEventTitle.state == "Kovy") { //.state.toString == "UNDEF"
sendBroadcastNotification("Vyvazaju kovy.", "sewerage", "WARN")
//+xiaomihub svetielko nacerveno
}
end
but for KalendarOdpady_NextEventStart.year the year is underscored with The method or field year is undefined for the type DateTimeItem(org.eclipse.xtext.diagnostics.Diagnostic.Linking)
KalendarOdpady_NextEventStart has a state description %1$td.%1$tm.%1$tY and it is displayed as 10.02.2022
what I am missing there?
where in OH can I see the actual value of val tomorrow?