I would have expected that to work on Rules DSL. Whatâ€™s not clear here is how that line fails. There is no error in the log.

Right now you have a java.time.ZonedDateTime in changed_at_time. You started with a ZonedDateTime and manipulated itâ€™s state but did change itâ€™s type.

Running with this, here is how it would be done with a Duration.

val myDur = Duration.ofHours(hours).plusMinutes(minutes)
val charged_at_time = now.plus(myDur)

There could be times where working with a duration might be easier, Iâ€™m not sure this is one of them.

But overall, I think it would make sense to just calculate the minutes and forget the hours. I think the following would work:

val time_to_charge = TeslaM3_time_to_full_charge.state as Number // It's better to cast to Number than DecimalType
val minutes = Math:round(time_to_charge * 60)
TeslaM3_time_charged.postUpdate(now.plusMinutes(minutes).toString())

Using a Duration gives you some convenience functions that might prove useful.

val time_to_charge = TeslaM3_time_to_full_charge.state as Number
val dur = Duration.ofMinutes(time_to_charge * 60)
// dur.toString() will print the duration in ISO8601 format, e.g. 6 hours 45 minutes would be PT6h45m
// dur.toHours() gives you just the hours
// dur.toMinutesPart() gives you the minutes after subtracting the hours
TeslaM3_time_charged.postUpdate(now.plus(dur).toString())

Again, thank you for your detailed explanationâ€¦ always appreciate yourâ€™s too rossko57

The Tesla API returns â€śtime_charged_to_set_levelâ€ť as decimal number. I am too lazy calculating the end time in my head, as it will change based on solar PV power levels.

Right, but you can convert that number to just minutes and save a step calculating the hours. Thatâ€™s the point of my reductions. now.plusHours(5).plusMinutes(10) is the same as now.plusMinutes(310).