Thanks @mueslee @vzorglub
I am getting an exception. Log:
2018-10-22 21:19:34.962 [WARN ] [ab.binding.http.internal.HttpBinding] - Transformation 'JS(pollenTime.js)' threw an exception. [response=[{
"loadedUrl": "https://www.melbournepollen.com.au/",
"loadingStartedAt": "2018-10-22T03:25:00.665Z",
"loadingFinishedAt": "2018-10-22T03:25:03.374Z",
"loadErrorCode": null,
"pageFunctionStartedAt": "2018-10-22T03:25:03.379Z",
"pageFunctionFinishedAt": "2018-10-22T03:25:03.382Z",
"isMainFrame": true,
"postData": null,
"contentType": null,
"method": "GET",
"willLoad": true,
"errorInfo": "",
"pageFunctionResult": {
"pollenToday": "Moderate",
"taToday": "Low",
"forecast2": "Low",
"forecast3": "Low",
"forecast4": "Moderate",
"forecast5": "Low",
"forecast6": "Low"
},
"interceptRequestData": null,
"downloadedBytes": 508749,
"queuePosition": "LAST",
"proxy": null,
"responseStatus": 200,
"responseHeaders": {
"Date": "Mon, 22 Oct 2018 03:24:45 GMT",
"Server": "Apache/2.4.6 (Red Hat Enterprise Linux) mod_wsgi/4.5.18 Python/3.6 PHP/5.4.16",
"X-Frame-Options": "SAMEORIGIN",
"X-Mod-Pagespeed": "1.13.35.2-0",
"Vary": "Accept-Encoding",
"Content-Encoding": "gzip",
"Cache-Control": "max-age=0, no-cache, s-maxage=10",
"Content-Type": "text/html; charset=utf-8",
"Age": "17",
"Warning": "110 squid/3.5.20 \"Response is stale\"",
"X-Cache": "HIT from wattle2.its.unimelb.edu.au",
"X-Cache-Lookup": "HIT from wattle2.its.unimelb.edu.au:8080",
"Transfer-Encoding": "chunked",
"Via": "1.1 wattle2.its.unimelb.edu.au (squid/3.5.20)",
"Connection": "keep-alive",
"Set-Cookie": "BIGipServer~AUSPOLLEN~z1_pl_melbournepollen_prod_8080=1700796588.36895.0000; path=/; Httponly; Secure"
},
"id": "lnNru3Pv23tpOVa",
"url": "https://www.melbournepollen.com.au/",
"requestedAt": "2018-10-22T03:25:00.572Z",
"uniqueKey": "https://www.melbournepollen.com.au",
"type": "StartUrl",
"label": null,
"referrerId": null,
"depth": 0,
"storageBytes": 1356
}]]
org.openhab.core.transform.TransformationException: An error occurred while executing script.
at org.openhab.core.transform.TransformationHelper$TransformationServiceDelegate.transform(TransformationHelper.java:67) [196:org.openhab.core.compat1x:2.3.0]
at org.openhab.binding.http.internal.HttpBinding.execute(HttpBinding.java:194) [259:org.openhab.binding.http:1.12.0]
at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:144) [196:org.openhab.core.compat1x:2.3.0]
at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:166) [196:org.openhab.core.compat1x:2.3.0]
pollenTime.js per your suggestion @mueslee:
(function(i) {
var data = JSON.parse(i);
return (data.loadingFinishedAt).slice(0, -1)+"+1100";
}
)(input)
item:
DateTime MelbPollen_lastupdate "Last Update [%1$tY-%1$tm-%1$td %1$tH:%1$tM]" <time> {http="<[MelbPollen:60000:JS(pollenTime.js)]" }
I can’t seem to figure out why… any help is greatly appreciated! Thanks in advance 