Weather prediction - using wunderground.com with a WiFi enabled ESP8266

I have been experimenting with OLED displays, json strings and Web Weather sites.

I plumped for the wunderground.com weather site.

You have to signup for a free account which allows you to poll the site 500 times a day (hum...so a scan every 2.5 minutes...not bad). They then supply you with a YOUR_KEY (see below).

I am using an ESP8266 as the wifi link to wunderground site.

By polling the site with this rough json string :-

 "GET /api/";YOUR_KEY; "/conditions/q/";LOCATIONID".json"; " HTTP/1.1\r\nHost: api.wunderground.com\r\n\r\n";

The "Weather" conditions I have chosen are :-

char* conds[]={
  "\"city\":",
  "\"local_time_rfc822\":",
  "\"weather\":",
  "\"temp_c\":",
  "\"relative_humidity\":",
  "\"wind_dir\":",
  "\"wind_kph\":",
  "\"pressure_mb\":"
};

The site sends back this string from a local weather station circa 1km from me :-

{"city":"Saint Gallen","local_time_rfc822":"Wed. 09 Dec 2015 15:55:48 +0100","weather":"Mostly Cloudy","temp_c":7,"relative_humidity":"100%","wind_dir":"Variable","wind_kph":2,"pressure_mb":"1038"}

Its relatively easy to parse the data and export the values to the OLED display. (codeing at the moment in need of haircut)

System is very compact.... and its possible to put the ESP8266 into sleep modus to save power ie. wake up every 2.5 minutes poll the website and sleep for 2.4 minutes. As the OLED has its own internal memory to keep the display alive...

-------------------------------------------------------------------------------

Below is a full json responce from San Francisco ,so you can see what other data can be extracted :-

{ "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": "San Francisco, CA", "city": "San Francisco", "state": "CA", "state_name": "California", "country": "US", "country_iso3166": "US", "zip": "94101", "latitude": "37.77500916", "longitude": "-122.41825867", "elevation": "47.00000000" }, "observation_location": { "full": "SOMA - Near Van Ness, San Francisco, California", "city": "SOMA - Near Van Ness, San Francisco", "state": "California", "country": "US", "country_iso3166": "US", "latitude": "37.773285", "longitude": "-122.417725", "elevation": "49 ft" }, "estimated": {}, "station_id": "KCASANFR58", "observation_time": "Last Updated on June 27, 5:27 PM PDT", "observation_time_rfc822": "Wed, 27 Jun 2012 17:27:13 -0700", "observation_epoch": "1340843233", "local_time_rfc822": "Wed, 27 Jun 2012 17:27:14 -0700", "local_epoch": "1340843234", "local_tz_short": "PDT", "local_tz_long": "America/Los_Angeles", "local_tz_offset": "-0700", "weather": "Partly Cloudy", "temperature_string": "66.3 F (19.1 C)", "temp_f": 66.3, "temp_c": 19.1, "relative_humidity": "65%", "wind_string": "From the NNW at 22.0 MPH Gusting to 28.0 MPH", "wind_dir": "NNW", "wind_degrees": 346, "wind_mph": 22.0, "wind_gust_mph": "28.0", "wind_kph": 35.4, "wind_gust_kph": "45.1", "pressure_mb": "1013", "pressure_in": "29.93", "pressure_trend": "+", "dewpoint_string": "54 F (12 C)", "dewpoint_f": 54, "dewpoint_c": 12, "heat_index_string": "NA", "heat_index_f": "NA", "heat_index_c": "NA", "windchill_string": "NA", "windchill_f": "NA", "windchill_c": "NA", "feelslike_string": "66.3 F (19.1 C)", "feelslike_f": "66.3", "feelslike_c": "19.1", "visibility_mi": "10.0", "visibility_km": "16.1", "solarradiation": "", "UV": "5", "precip_1hr_string": "0.00 in ( 0 mm)", "precip_1hr_in": "0.00", "precip_1hr_metric": " 0", "precip_today_string": "0.00 in (0 mm)", "precip_today_in": "0.00", "precip_today_metric": "0", "icon": "partlycloudy", "icon_url": "http://icons-ak.wxug.com/i/c/k/partlycloudy.gif", "forecast_url": "http://www.wunderground.com/US/CA/San_Francisco.html", "history_url": "http://www.wunderground.com/history/airport/KCASANFR58/2012/6/27/DailyHistory.html", "ob_url": "http://www.wunderground.com/cgi-bin/findweather/getForecast?query=37.773285,-122.417725" } }