Personal tools

Wunderground example

From PhotoVoltaic Logger new generation

Jump to: navigation, search

The Wunderground API delivers simple JSON as response.

Therefor we can use a JSON based grouping channel to store sesveral readings.

Request

Example request:

http://api.wunderground.com/api/<your_key>/conditions/lang:DL/q/51.548203,12.131052.json

Result

{
     "response": {
         "version":"0.1",
         "termsofService":"http://www.wunderground.com/weather/api/d/terms.html",
         "features": {
             "conditions": 1
         }
     },
     "current_observation": {
         "image": {
             "url":"http://icons-ak.wxug.com/graphics/wu2/logo_130x80.png",
             "title":"Weather Underground",
             "link":"http://www.wunderground.com"
         },
         "display_location": {
             "full":"Landsberg, Deutschland",
             "city":"Landsberg",
             "state":"",
             "state_name":"Deutschland",
             "country":"DL",
             "country_iso3166":"DE",
             "zip":"00000",
             "magic":"48",
             "wmo":"10466",
             "latitude":"51.540000",
             "longitude":"12.130000",
             "elevation":"104.00000000"
         },
         "observation_location": {
             "full":"Leipzig Schkeuditz, ",
             "city":"Leipzig Schkeuditz",
             "state":"",
             "country":"DL",
             "country_iso3166":"DE",
             "latitude":"51.43476868",
             "longitude":"12.23966026",
             "elevation":"463 ft"
         },
         "estimated": {
         },
         "station_id":"EDDP",
         "observation_time":"Last Updated on März 16, 19:50 CET",
         "observation_time_rfc822":"Sun, 16 Mar 2014 19:50:00 +0100",
         "observation_epoch":"1394995800",
         "local_time_rfc822":"Sun, 16 Mar 2014 19:53:37 +0100",
         "local_epoch":"1394996017",
         "local_tz_short":"CET",
         "local_tz_long":"Europe/Berlin",
         "local_tz_offset":"+0100",
         "weather":"Leichter Regen",
         "temperature_string":"50 F (10 C)",
         "temp_f":50,
         "temp_c":10,
         "relative_humidity":"87%",
         "wind_string":"From the West at 17 MPH",
         "wind_dir":"West",
         "wind_degrees":270,
         "wind_mph":17,
         "wind_gust_mph":0,
         "wind_kph":28,
         "wind_gust_kph":0,
         "pressure_mb":"1014",
         "pressure_in":"29.95",
         "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":"50 F (10 C)",
         "feelslike_f":"50",
         "feelslike_c":"10",
         "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-ak.wxug.com/i/c/k/nt_rain.gif",
         "forecast_url":"http://www.wunderground.com/global/stations/10466.html",
         "history_url":"http://www.wunderground.com/history/airport/EDDP/2014/3/16/DailyHistory.html",
         "ob_url":"http://www.wunderground.com/cgi-bin/findweather/getForecast?query=51.43476868,12.23966026"
     }
 }

Channel settings

We need here for example the path to the temperature in °C (temp_c), so store the channel as this:

{
    ...
    "current_observation": {
        ...
        "temp_c":10,
        ...
    }
}

WundergroundTempChannel.png


PVLng have a pre-defined channel type Wunderground, a template and a script for this.


WundergroundTemplate.png