I’m using the latest OpenHab version 2.5.8 and I just tried to implement the transformRaw example from the rules documentation into one of my rules, but this example does not seem to work anymore. I get the following error when compiling the rule:
The method transformRaw(String, String, String) from the type Transformation refers to the missing type Object
Also the TransformationException type was not found.
I didn’t find anything about this problem in the here in the community forum. The transformRaw method is only mentioned once in the whole forum. Is this command still supported or should I report this issue on GitHub?
Yes, I use the function in another function to get the zwave lastpacketreceived value from the OH api. Here is the code of the function:
val Functions.Function1<String, DateTime> getZwaveLastPacketReceived = [
String nodeUid |
var String url = String::format("http://127.0.0.1:8080/rest/things/%s", nodeUid)
var String json = sendHttpGetRequest(url)
try {
var String lastPacketReceived = transformRaw("JSONPATH", "$.properties.zwave_lastwakeup", json)
var DateTime dtLastPacketReceived = parse(lastPacketReceived)
return dtLastPacketReceived.withZone(DateTimeZone::getDefault());
}
catch (TransformationException e) {
logError("getZwaveLastPacketReceived", e.toString())
return new DateTime(0)
}
]