Hi all,
Recently upgraded to OH3 and I don’t seem to be able to fix this last issue with time conversion from my old rules to java-time.
I am therefore hoping for someone to assist in converting the to times (now.isAfter and now.isBefore) to java time:-)
Thank you!
Peter
rule "OpenHAB system started - astro"
when
System started
then
createTimer(now.plusSeconds(180)) [ |
logInfo("RULE", "--> astro init")
if (now.isAfter((CivilDusk.state as DateTimeType).zonedDateTime.toInstant.toEpochMilli) ||
now.isBefore((CivilDawn.state as DateTimeType).zonedDateTime.toInstant.toEpochMilli)
) {
logInfo("RULE", "--> Night ON")
postUpdate(Night, ON)
postUpdate(Day, OFF)
postUpdate(swDaylight, OFF)
} else {
logInfo("RULE", "--> Day ON")
postUpdate(Night, OFF)
postUpdate(Day, ON)
postUpdate(swDaylight, ON)
}
]
end