Hello All.
I have just installed my own weather station and on the following link
https://api.weather.com/v2/pws/observations/current?apiKey=XXXXXXXXXXXXXXXXXe&stationId=XXXXXX&format=json&units=m
are some data which I am trying to get into my openhab.
{“observations”: [ {“stationID”:“IHRKY4”, “obsTimeUtc”:“2022-01-26T13:32:09Z”, “obsTimeLocal”:“2022-01-26 14:32:09”,“solarRadiation”:4.0,“lon”:18.685472,“uv”:0.0,“winddir”:21,“humidity”:64,“qcStatus”:0,“metric”:{“temp”:23,“heatIndex”:23,“dewpt”:15,“windChill”:23,“windSpeed”:0,“windGust”:0,“pressure”:1008.64,“precipRate”:0.00,“precipTotal”:0.00,“elev”:114}}]}
What I am using is:
Thing:
Thing http:url:WeatherHorky "Weather"
[ baseURL="https://api.weather.com/v2/pws/observations/current?apiKey=XXXXXXXXXXXXXXXXXe&stationId=StationId&format=json&units=m",
authMode="BASIC_PREEMPTIVE",
stateMethod="GET",
commandMethod="GET",
refresh=10,
timeout=10000
]
{
Channels:
Type number : chHumidity "Humidity" [ stateTransformation="JSONPATH:$.observations.humidity"]
}
Item:
Number chHumidity "humidity [%s]" <humidity> ["Measurement", "Humidity"] {channel="http:url:WeatherHorky:chHumidity"}
Unfortunately I am unable to get any value to openhab. I have found out, it is caused by the square brackets.
{“observations”: [ {“stationID”:…} ] }.
Can anybody give me a hand, how should the transformation look like, or any other idea.
Many thanks in advace.