Hi Daniel, i believe that needs more context. CreateTimer needs a number and some info´s how long etc…
an example:
if (Washingmachine_OpState2.state == MODE_ACTIVE) {
if(tWashing_Machine === null) {
logInfo("washing", "Timer created.")
tWashing_Machine = createTimer(now.plusMinutes(5), [ |
Washingmachine_OpState2.postUpdate(MODE_FINISHED)
logInfo("washing", "Timer expired. Washing Machine FINISHED.")
tWashing_Machine = null
])
}
}
If you want to start the timer when a certain time has come, you need a comparison of 2 dates first and than start a timer for a certain amount of time ( seconds, minutes, hours … )
Here is a good example how to do date comparison:
or more simple:
val startdate = (RolladenControlCalendar_1_start.state as DateTimeType).getZonedDateTime()
if (now.isAfter(startdate)) { do stuff ....for example create a timer...