Hello community,
I tried to setup the fire index information from swedish SMHI (SMHI Open Data API Docs - Fire risk Forecasts) to fill some items with relevant indexes.
The .things file looks like this:
Thing http:url:fireRiskForecast "SMHI Fire Risk Forecasts" [
baseURL="https://opendata-download-metfcst.smhi.se/api/category/fwif1g/version/1/daily/geotype/point/lon/15.9896/lat/57.4788/data.json",
refresh=300,
timeout=5000] {
Channels:
Type string : fireRiskIndex "Brandrisiko" [ stateTransformation="JSONPATH:$.timeSeries.[0].[?(@.name=='fwiindex')]" ]
Type string : grassFireRisk "Grasbrandrisiko" [ stateTransformation="JSONPATH:$.timeSeries.[0].[?(@.name=='grassfire')]" ]
Type string : forestDry "Waldtrockenheit" [ stateTransformation="JSONPATH:$.timeSeries.[0].[?(@.name=='forestdry')]" ]
Type string : approvedTime "Bestätigt für" [ stateTransformation="JSONPATH:$.['approvedTime']" ]
}
And my .items are as follows:
Group WeatherFireRisk "Brandgefahr"
String WeatherFireRiskIndex "Brandrisiko [MAP(fireRiskIndex.map):%s]" <fire> (WeatherFireRisk) {channel="http:url:fireRiskForecast:fireRiskIndex"}
String WeatherGrassFireRisk "Grasbrandrisiko [MAP(grassFireRisk.map):%s]" <fire> (WeatherFireRisk) {channel="http:url:fireRiskForecast:grassFireRisk"}
String WeatherForestDry "Waldtrockenheit [MAP(forestDry.map):%s]" <fire> (WeatherFireRisk) {channel="http:url:fireRiskForecast:forestDry"}
DateTime WeatherFireApprovedTime "Bestätigt für [%1$tR, %1$tb %1$td]" <timestamp> (WeatherFireRisk) {channel="http:url:fireRiskForecast:approvedTime"}
The item WeatherFireApprovedTime is filled by the data from the json (allthough it has a 1h offset, whyever?) but the other values remain NULL.
I tested my JSONPATHs by using jsonpath.com and there the path is found.
The only thing I noticed are some errors that occur every 4-6 hours:
[WARN ] [p.internal.http.HttpResponseListener] - Requesting 'https://opendata-download-metfcst.smhi.se/api/category/fwif1g/version/1/daily/geotype/point/lon/15.9896/lat/57.4788/data.json' (method='GET', content='null') failed: java.util.concurrent.TimeoutException: Total timeout 5000 ms elapsed
But this doesn’t seem to be the issue - I’m on an 4G connection and with this, things like this happen from time to time.
Has anybody any idea why the items don’t get filled?
To be complete, here are the .maps:
fireRiskIndex.map
\-=\-
=\-
\-1=Keine\ Daten
1=Sehr\ niedrig
2=Niedrig
3=Gering
4=Hoch
5=Sehr\ hoch
6=Extrem\ hoch
grassFireRisk.map
\-=\-
=\-
\-1=Keine\ Saison
1=Schneebedeckt
2=Grasbrandsaison\ vorbei
3=Niedrig
4=Gering
5=Hoch
6=Sehr\ hoch
forestDry.map
\-=\-
=\-
\-1=Keine\ Daten
1=Sehr\ feucht
2=Feucht
3=Leicht\ feucht
4=Trocken
5=Sehr\ trocken
6=Extrem\ trocken