I’m trying to get an item automatically transformed into the right format, which I import via JSONPATH.
So, the JSON looks like this:
{
"vehicles": {
"infoTimestamp": 1592423460470
}
}
I’d like to convert this UNIX-Timestamp into ISO-Timestamp using this timestamp.js
(function(ts2iso){
var otdata = JSON.parse(json);
return new Date(otdata.tst * 1000).toISOString();
})(input)
So, I figured, the item for it, should look something like:
DateTime InfoTimestamp "Info Zeit [%1$ta %1$tR]" { http="<[NIU:30000:JSONPATH($.vehicles.infoTimestamp):JS(timestamp.js)]" }
but I then get this one:
2020-06-18 08:33:44.213 [WARN ] [ab.binding.http.internal.HttpBinding] - Transformation 'JSONPATH($.vehicles.infoTimestamp):JS(timestamp.js)' threw an exception. [response={"vehicles":{"infoTimestamp":1592461860418}}]
Is there something in the syntax I missed? or can JS-transformations AND JSONPATH not work together?