Hallo,
ich würde gerne die Wetterdaten von Wunderground in OpenHab nutzen, allerdings habe ich bisher kaum Erfahrung mit JSON.
Mit der Benzinpreis App vom Tankenkönig hat es gut geklappt, die Daten aus dem JSON zu lesen.
Nur wie bekomme ich die gewünschten Werte in ein Item.
Das ist die Rückgabe aus dem Call:
Ich würde gerne folgende aktuelle Werte auslesen
weather, temp_c, wind_dir, wind_kph, pressure_mb
Und die Vorhersage für die nächsten Tage mit Höchst-und Tiefsttemperatur und die Konditionen. Sollte sich noch die Niederschlagswahrscheinlichkeit rausbekommen lassen, wäre das super!
Kann mir vielleicht jemand helfen?
Viele Dank vorab
Martin
ich würde gerne die Wetterdaten von Wunderground in OpenHab nutzen, allerdings habe ich bisher kaum Erfahrung mit JSON.
Mit der Benzinpreis App vom Tankenkönig hat es gut geklappt, die Daten aus dem JSON zu lesen.
Nur wie bekomme ich die gewünschten Werte in ein Item.
Das ist die Rückgabe aus dem Call:
Code:
{ "response": { "version":"0.1", "termsofService":"http://www.wunderground.com/weather/api/d/terms.html", "features": { "forecast": 1 , "geolookup": 1 , "conditions": 1 } } , "location": { "type":"INTLCITY", "country":"DL", "country_iso3166":"DE", "country_name":"Germany", "state":"", "city":"Ketsch", "tz_short":"CET", "tz_long":"Europe/Berlin", "lat":"49.36777878", "lon":"8.53111076", "zip":"00000", "magic":"21", "wmo":"WETIE", "l":"/q/zmw:00000.21.WETIE", "requesturl":"global/stations/WETIE.html", "wuiurl":"http://www.wunderground.com/global/stations/WETIE.html", "nearby_weather_stations": { "airport": { "station": [ { "city":"", "state":"", "country":"", "icao":"", "lat":"", "lon":"" } ,{ "city":"Mannheim", "state":"", "country":"DL", "icao":"EDFM", "lat":"49.50902939", "lon":"8.55399990" } ] } , "pws": { "station": [ { "neighborhood":"Dossenheimer Straße", "city":"Ketsch", "state":"", "country":"DL", "id":"IKETSCH6", "lat":49.370670, "lon":8.534780, "distance_km":0, "distance_mi":0 }, ] } } } , "current_observation": { "image": { "url":"http://icons.wxug.com/graphics/wu2/logo_130x80.png", "title":"Weather Underground", "link":"http://www.wunderground.com" }, "display_location": { "full":"Ketsch, Germany", "city":"Ketsch", "state":"", "state_name":"Germany", "country":"DL", "country_iso3166":"DE", "zip":"00000", "magic":"21", "wmo":"WETIE", "latitude":"49.36777878", "longitude":"8.53111076", "elevation":"101.00000000" }, "observation_location": { "full":"Mannheim, ", "city":"Mannheim", "state":"", "country":"DL", "country_iso3166":"DE", "latitude":"49.50902939", "longitude":"8.55399990", "elevation":"328 ft" }, "estimated": { }, "station_id":"EDFM", "observation_time":"Last Updated on January 31, 8:20 PM CET", "observation_time_rfc822":"Sun, 31 Jan 2016 20:20:00 +0100", "observation_epoch":"1454268000", "local_time_rfc822":"Sun, 31 Jan 2016 20:26:11 +0100", "local_epoch":"1454268371", "local_tz_short":"CET", "local_tz_long":"Europe/Berlin", "local_tz_offset":"+0100", "weather":"Light Rain", "temperature_string":"48 F (9 C)", "temp_f":48, "temp_c":9, "relative_humidity":"93%", "wind_string":"From the SSW at 9 MPH", "wind_dir":"SSW", "wind_degrees":200, "wind_mph":9, "wind_gust_mph":0, "wind_kph":15, "wind_gust_kph":0, "pressure_mb":"1012", "pressure_in":"29.89", "pressure_trend":"+", "dewpoint_string":"46 F (8 C)", "dewpoint_f":46, "dewpoint_c":8, "heat_index_string":"NA", "heat_index_f":"NA", "heat_index_c":"NA", "windchill_string":"NA", "windchill_f":"NA", "windchill_c":"NA", "feelslike_string":"48 F (9 C)", "feelslike_f":"48", "feelslike_c":"9", "visibility_mi":"6.2", "visibility_km":"10.0", "solarradiation":"--", "UV":"0","precip_1hr_string":"-9999.00 in (-9999.00 mm)", "precip_1hr_in":"-9999.00", "precip_1hr_metric":"--", "precip_today_string":"0.00 in (0.0 mm)", "precip_today_in":"0.00", "precip_today_metric":"0.0", "icon":"rain", "icon_url":"http://icons.wxug.com/i/c/k/nt_rain.gif", "forecast_url":"http://www.wunderground.com/global/stations/WETIE.html", "history_url":"http://www.wunderground.com/history/airport/EDFM/2016/1/31/DailyHistory.html", "ob_url":"http://www.wunderground.com/cgi-bin/findweather/getForecast?query=49.50902939,8.55399990", "nowcast":"" } , "forecast":{ "txt_forecast": { "date":"7:30 PM CET", "forecastday": [ { "period":0, "icon":"chancerain", "icon_url":"http://icons.wxug.com/i/c/k/chancerain.gif", "title":"Sunday", "fcttext":"Light rain. Lows overnight in the mid 40s.", "fcttext_metric":"Periods of light rain. Low 8C.", "pop":"50" } , { "period":1, "icon":"nt_chancerain", "icon_url":"http://icons.wxug.com/i/c/k/nt_chancerain.gif", "title":"Sunday Night", "fcttext":"Occasional light rain. Low 46F. Winds WSW at 10 to 20 mph. Chance of rain 50%.", "fcttext_metric":"Cloudy with occasional light rain . Low 8C. Winds WSW at 15 to 30 km/h. Chance of rain 50%.", "pop":"50" } , { "period":2, "icon":"cloudy", "icon_url":"http://icons.wxug.com/i/c/k/cloudy.gif", "title":"Monday", "fcttext":"Overcast. High near 55F. Winds WSW at 15 to 25 mph.", "fcttext_metric":"Overcast. High 13C. Winds WSW at 15 to 30 km/h.", "pop":"20" } , { "period":3, "icon":"nt_cloudy", "icon_url":"http://icons.wxug.com/i/c/k/nt_cloudy.gif", "title":"Monday Night", "fcttext":"Cloudy. Low near 50F. Winds SW at 10 to 20 mph.", "fcttext_metric":"Cloudy skies. Low near 10C. Winds SW at 15 to 30 km/h.", "pop":"20" } , { "period":4, "icon":"cloudy", "icon_url":"http://icons.wxug.com/i/c/k/cloudy.gif", "title":"Tuesday", "fcttext":"Cloudy. High near 55F. Winds SW at 15 to 25 mph.", "fcttext_metric":"Overcast. High 13C. Winds SW at 15 to 30 km/h.", "pop":"20" } , { "period":5, "icon":"nt_rain", "icon_url":"http://icons.wxug.com/i/c/k/nt_rain.gif", "title":"Tuesday Night", "fcttext":"Occasional rain. Low 43F. Winds WSW at 15 to 25 mph. Chance of rain 90%.", "fcttext_metric":"Cloudy with periods of rain. Low 6C. Winds WSW at 25 to 40 km/h. Chance of rain 90%.", "pop":"90" } , { "period":6, "icon":"partlycloudy", "icon_url":"http://icons.wxug.com/i/c/k/partlycloudy.gif", "title":"Wednesday", "fcttext":"Intervals of clouds and sunshine. High 47F. Winds W at 10 to 20 mph.", "fcttext_metric":"Sunshine and clouds mixed. High 8C. Winds W at 15 to 30 km/h.", "pop":"20" } , { "period":7, "icon":"nt_partlycloudy", "icon_url":"http://icons.wxug.com/i/c/k/nt_partlycloudy.gif", "title":"Wednesday Night", "fcttext":"Partly cloudy skies. Low 37F. Winds WSW at 10 to 15 mph.", "fcttext_metric":"A few clouds. Low 3C. Winds WSW at 15 to 25 km/h.", "pop":"20" } ] }, "simpleforecast": { "forecastday": [ {"date":{ "epoch":"1454263200", "pretty":"7:00 PM CET on January 31, 2016", "day":31, "month":1, "year":2016, "yday":30, "hour":19, "min":"00", "sec":0, "isdst":"0", "monthname":"January", "monthname_short":"Jan", "weekday_short":"Sun", "weekday":"Sunday", "ampm":"PM", "tz_short":"CET", "tz_long":"Europe/Berlin" }, "period":1, "high": { "fahrenheit":"48", "celsius":"9" }, "low": { "fahrenheit":"46", "celsius":"8" }, "conditions":"Chance of Rain", "icon":"chancerain", "icon_url":"http://icons.wxug.com/i/c/k/chancerain.gif", "skyicon":"", "pop":50, "qpf_allday": { "in": 0.03, "mm": 1 }, "qpf_day": { "in": null, "mm": null }, "qpf_night": { "in": 0.04, "mm": 1 }, "snow_allday": { "in": 0.0, "cm": 0.0 }, "snow_day": { "in": null, "cm": null }, "snow_night": { "in": 0.0, "cm": 0.0 }, "maxwind": { "mph": 10, "kph": 17, "dir": "South", "degrees": 0 }, "avewind": { "mph": 6, "kph": 9, "dir": "SSW", "degrees": 0 }, "avehumidity": 87, "maxhumidity": 0, "minhumidity": 0 } , {"date":{ "epoch":"1454349600", "pretty":"7:00 PM CET on February 01, 2016", "day":1, "month":2, "year":2016, "yday":31, "hour":19, "min":"00", "sec":0, "isdst":"0", "monthname":"February", "monthname_short":"Feb", "weekday_short":"Mon", "weekday":"Monday", "ampm":"PM", "tz_short":"CET", "tz_long":"Europe/Berlin" }, "period":2, "high": { "fahrenheit":"55", "celsius":"13" }, "low": { "fahrenheit":"50", "celsius":"10" }, "conditions":"Overcast", "icon":"cloudy", "icon_url":"http://icons.wxug.com/i/c/k/cloudy.gif", "skyicon":"", "pop":20, "qpf_allday": { "in": 0.00, "mm": 0 }, "qpf_day": { "in": 0.00, "mm": 0 }, "qpf_night": { "in": 0.00, "mm": 0 }, "snow_allday": { "in": 0.0, "cm": 0.0 }, "snow_day": { "in": 0.0, "cm": 0.0 }, "snow_night": { "in": 0.0, "cm": 0.0 }, "maxwind": { "mph": 25, "kph": 40, "dir": "WSW", "degrees": 242 }, "avewind": { "mph": 17, "kph": 27, "dir": "WSW", "degrees": 242 }, "avehumidity": 76, "maxhumidity": 0, "minhumidity": 0 } , {"date":{ "epoch":"1454436000", "pretty":"7:00 PM CET on February 02, 2016", "day":2, "month":2, "year":2016, "yday":32, "hour":19, "min":"00", "sec":0, "isdst":"0", "monthname":"February", "monthname_short":"Feb", "weekday_short":"Tue", "weekday":"Tuesday", "ampm":"PM", "tz_short":"CET", "tz_long":"Europe/Berlin" }, "period":3, "high": { "fahrenheit":"55", "celsius":"13" }, "low": { "fahrenheit":"43", "celsius":"6" }, "conditions":"Overcast", "icon":"cloudy", "icon_url":"http://icons.wxug.com/i/c/k/cloudy.gif", "skyicon":"", "pop":20, "qpf_allday": { "in": 0.18, "mm": 5 }, "qpf_day": { "in": 0.00, "mm": 0 }, "qpf_night": { "in": 0.18, "mm": 5 }, "snow_allday": { "in": 0.0, "cm": 0.0 }, "snow_day": { "in": 0.0, "cm": 0.0 }, "snow_night": { "in": 0.0, "cm": 0.0 }, "maxwind": { "mph": 25, "kph": 40, "dir": "SW", "degrees": 224 }, "avewind": { "mph": 17, "kph": 27, "dir": "SW", "degrees": 224 }, "avehumidity": 75, "maxhumidity": 0, "minhumidity": 0 } , {"date":{ "epoch":"1454522400", "pretty":"7:00 PM CET on February 03, 2016", "day":3, "month":2, "year":2016, "yday":33, "hour":19, "min":"00", "sec":0, "isdst":"0", "monthname":"February", "monthname_short":"Feb", "weekday_short":"Wed", "weekday":"Wednesday", "ampm":"PM", "tz_short":"CET", "tz_long":"Europe/Berlin" }, "period":4, "high": { "fahrenheit":"47", "celsius":"8" }, "low": { "fahrenheit":"37", "celsius":"3" }, "conditions":"Partly Cloudy", "icon":"partlycloudy", "icon_url":"http://icons.wxug.com/i/c/k/partlycloudy.gif", "skyicon":"", "pop":20, "qpf_allday": { "in": 0.00, "mm": 0 }, "qpf_day": { "in": 0.00, "mm": 0 }, "qpf_night": { "in": 0.00, "mm": 0 }, "snow_allday": { "in": 0.0, "cm": 0.0 }, "snow_day": { "in": 0.0, "cm": 0.0 }, "snow_night": { "in": 0.0, "cm": 0.0 }, "maxwind": { "mph": 20, "kph": 32, "dir": "W", "degrees": 264 }, "avewind": { "mph": 16, "kph": 26, "dir": "W", "degrees": 264 }, "avehumidity": 67, "maxhumidity": 0, "minhumidity": 0 } ] } } }
weather, temp_c, wind_dir, wind_kph, pressure_mb
Und die Vorhersage für die nächsten Tage mit Höchst-und Tiefsttemperatur und die Konditionen. Sollte sich noch die Niederschlagswahrscheinlichkeit rausbekommen lassen, wäre das super!
Kann mir vielleicht jemand helfen?
Viele Dank vorab
Martin
Kommentar