Conversion of date&time utc String to DateTime Item


i’m trying to parse a string that i receive from my weather station each time data is updated. As the string is utc based and the time needs to be adopted to the correct time zone, I want to convert it from String to DateTimeType and then assign to a DateTime Item.

The item are defined like this:
String Weather_Local_dateutc “Letzte Aktualisierung [%s]” (Weather_Local)
DateTime Weather_Local_lastupdate “Letzte Aktualisierung [%1$d.%1$m.%1$y %1$Tp]” (Weather_Local)

Weather_Local_dateutc is updated via a REST API Call and triggers the rule below. Unfortunately the rule causes an error like this:
[ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘ParseWeatherDate’: An error occurred during the script execution: Could not invoke method: org.eclipse.smarthome.model.script.actions.BusEvent.postUpdate(org.eclipse.smarthome.core.items.Item,org.eclipse.smarthome.core.types.State) on instance: null

import org.joda.time
import org.joda.datetime

rule "ParseWeatherDate"
    Item Weather_Local_dateutc changed 
    var str = Weather_Local_dateutc.state.toString().split(" ")
    var dtstr = str.get(0) + "T" + str.get(1);
    var DateTimeType dt = parse(dtstr);
    postUpdate(Weather_Local_lastupdate, dt);

This only accepts strings as second argument.

postUpdate(Weather_Local_lastupdate, dt)

Try this


PS: you don’t need the semicolon.

Unfortunately this doesn’t change anything. Still the same Exception.
Some version details: Running Openhabian with Openhab 2.3.0-1

And interestingly this works:

Weather_Local_lastupdate.postUpdate(new DateTimeType())

Relly strange ….