Umstieg auf OH3 gibt es wieder Fehler, das war meine rule
Code: Alles auswählen
rule "Weihnachtsmodus an"
when
Time cron "0 0 0 * * ?" or
System started
then
val year = now.getYear
val month = now.getMonth //OfYear
val day = now.getDayOfMonth
val sdatum = year+"-"+month+"-"+day
val DateTime datum = parse(sdatum)
val DateTime stAdvent = parse(year + "-12-25").minusDays(((parse(year + "-12-25").getDayOfWeek) + 21))
val DateTime endWeih = parse(year + "-1-1") // parse(year + "-1-6")
logInfo("RULE", "--> Weihnachtsmodus. Datum: " + datum.toString + ". 1. Advent: " + stAdvent.toString + ". Silvester: " + endWeih.toString)
if ( stAdvent <= datum || datum <= endWeih ) {
Weihnachtsbeleuchtung.sendCommand(ON)
}
else
{ Weihnachtsbeleuchtung.sendCommand(OFF)
logInfo("RULE", "--> Weihnachtsmodus OFF")
}
end
also hab ich die Zeilen so geändert
Code: Alles auswählen
val ZonedDateTime datum = parse(sdatum)
val ZonedDateTime stAdvent = parse(year + "-12-25").minusDays(((parse(year + "-12-25").getDayOfWeek) + 21))
val ZonedDateTime endWeih = parse(year + "-1-1") // parse(year + "-1-6")
Code: Alles auswählen
Ambiguous feature call.
The methods
parse(CharSequence) in Duration and
parse(CharSequence) in ZonedDateTime
both match.
Type mismatch: cannot convert from Duration to ZonedDateTime
The method or field getDayOfWeek is undefined for the type Duration