ich habe eine Rule bei der ich den Status eines Items von Nacht auf Tag (und umgekehrt) abhängig von Astro umschalte.
Die Rule schaut folgendermaßen aus:
Code: Alles auswählen
rule "OpenHAB system started - astro"
when
System started
then
createTimer(now.plusSeconds(180)) [ |
logInfo("RULE", "--> astro init")
if (now.isAfter((Sunset_Time.state as DateTimeType).calendar.timeInMillis) ||
now.isBefore((Sunrise_Time.state as DateTimeType).calendar.timeInMillis)
) {
logInfo("RULE", "--> Night_State ON")
postUpdate(Night_State, ON)
} else {
logInfo("RULE", "--> Night_State OFF")
postUpdate(Night_State, OFF)
}
]
end
Code: Alles auswählen
The method or field calendar is undefined for the type DateTimeType
Allerdings ein
Code: Alles auswählen
(now.isAfter((Sunset_Time.state as DateTimeType).zonedDateTime.toInstant.toEpochMilli)
Code: Alles auswählen
Type mismatch: cannot convert from long to ChronoZonedDateTime<?>(org.eclipse.xtext.xbase.validation.IssueCodes.incompatible_types)