Fantastic job Coffee! There are two take-aways for me here. First, I had ported JSMN to Spark but the JsonParser package is excellent. That one is worth making into a standard library. The second is this project has given me an idea for a Maker Kit project!
It’s awesome that the Json-Parser works without modifications, and small memory footprint. If you agree, we should suggest it for inclusion into the spark-libs.
Coffee, I noticed that you don’t grab the current temperature in the weather_response_t structure. Any reason cause it would be great to show the daily min/high and the actual. Any thoughts?
For my project it was important to see the whole day waither, but you can also use the current weahter.
it’s a different URL for the current weather, see here: http://openweathermap.org/API#weather (compared to “5 and 14-days forecast” which I am currently using).
you could just make another http call in the update() method.
I’m currently using a Spark Core and a Temp/Humidity Sensor SHT-15 to display current temp and humidity data in the house and then that data gets displayed on my Digole color LCD display & uploaded to my Google Excel Spreadsheet account and then graphed out over time for review later.
I have been wanting to add the outside weather data to this display also by using the Sparks WiFi connection to eliminate the need of using an extra temp sensor to gather outside weather data.
As @peekay123 mentioned, I would also like to pull in current weather temp, humidity, and data that shows the weather condition like (Cloudy, Rain, Sunny, ect…).
If we took this weather app and combined it with my current local temp sensor app with data upload to Google Drive we would have a pretty cool WiFi enabled weather station. I would like to display the weather data one some sort of LED display like this. https://www.adafruit.com/products/420
Fantastic.
Must admit I am having some trouble with https://github.com/synox/openweathermap-spark-lib. All loaded OK to Spark using spark-cli but getting the “weather request failed HttpClient> Connection failed” error. Really don’t know why.
Greetings from Sydney, AU. I’m not a coder and am having some problems attempting to write code to download the next 24hrs weather forecast using the openweather.org API and your technique outlined above.
I realise this gives many days of data, but I’m only interested in the current 24 hours (every 3hr is OK for me).
Which specific libraries do I need to include? I’m using spark-cli to flash the core.
I’m also having problems with the HTTP Client not connecting giving error -" HTTPClient> Connection failed". I actually investigated and the “http_response.status” is returning “-1”.
I’m using the exact code example from here (with my API added):
OK. This is getting silly. I have no idea which .CPP and .H files I need to get this working.
I have now manually uploaded 18 different library files to the Spark IDE and even with a blank program(#includes and void setup and void loop only) it is giving multiple compile errors.
Here is the list I have (both .cpp and .h):
HTTPClient
jsmn
JsonArray
JsonPArser
JsonParserBase
JsonToken
JsonValue
JsonObject
@InventorSteve, it is not your fault! I tried compiling the code with Spark CLI (which uses the same build servers) and it gives me indeterminate errors as well. I have found that it will only compile locally with the full toolchain and the latest github repo. I will be doing some tests a bit later to see if that still holds true since it has been a couple of months since the last time I tried and much has changed since!
@InventorSteve, I can’t get my code to compile locally or with spark cli!!! I get cryptic undefined reference errors which I can’t figure out. Stay tuned.
I currently also have problems with the spark-cli, it stops just with the message “Compile failed - compile failed”, and i also had problems with http not connecting.
unfortunately I am currently to busy to debug the issue.