From 447ce054b5a11c819328d3c62a4c0419f0f14745 Mon Sep 17 00:00:00 2001 From: Jessica Hershey <60907719+JHershey69@users.noreply.github.com> Date: Tue, 30 Jul 2024 09:13:52 -0400 Subject: [PATCH 1/7] Update library.properties 3.3.3 --- library.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library.properties b/library.properties index f8a917f..02596c4 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=OpenWeatherOneCall -version=3.3.2 +version=3.3.3 author=JHershey69 maintainer=JHershey69 sentence=Current and Seven Day Weather Forecast Library for ESP32. From 10ab917fc1f9bf2453bcd27a3af8a473dfad4ae1 Mon Sep 17 00:00:00 2001 From: Jessica Hershey <60907719+JHershey69@users.noreply.github.com> Date: Tue, 30 Jul 2024 09:15:37 -0400 Subject: [PATCH 2/7] Update library.json 3.3.3 --- library.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library.json b/library.json index d80a8d5..259a1e4 100644 --- a/library.json +++ b/library.json @@ -1,8 +1,8 @@ { "name": "OpenWeatherOneCall", - "version": "3.3.2", + "version": "3.3.3", "keywords": "openweather, darksky, weather, esp32, arduino", - "description": "OpenWeatherMap Library to use One Call on the ESP32. This library allows the ESP32 to receive and parse the json from OpenWeathermap", + "description": "OpenWeatherMap Library to use One Call on the ESP32. This library allows the ESP32 to receive and parse the json from OpenWeatherMap", "dependencies": [ { From ebfb29960701a074c2e88b2fb0fe98f29843f5fe Mon Sep 17 00:00:00 2001 From: Jessica Hershey <60907719+JHershey69@users.noreply.github.com> Date: Tue, 30 Jul 2024 09:17:24 -0400 Subject: [PATCH 3/7] Update OpenWeatherOneCall.cpp 3.3.3 --- src/OpenWeatherOneCall.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/OpenWeatherOneCall.cpp b/src/OpenWeatherOneCall.cpp index 8d10d5f..e5717d8 100644 --- a/src/OpenWeatherOneCall.cpp +++ b/src/OpenWeatherOneCall.cpp @@ -1,5 +1,5 @@ /* - OpenWeatherOneCall.cpp v3.3.2 + OpenWeatherOneCall.cpp v3.3.3 copyright 2020 - Jessica Hershey www.github.com/JHershey69 @@ -47,10 +47,12 @@ int OpenWeatherOneCall::parseWeather(void) { int error_code = 0; + // WiFi.status not declared in this scope error if (WiFi.status() != WL_CONNECTED) { return 25; } + // End WiFi error unsigned int SIZE_CAPACITY = 32768; @@ -661,7 +663,7 @@ int OpenWeatherOneCall::createAQ(int sizeCap) char getURL[200] = {0}; sprintf(getURL,"%s%.6f%s%.6f%s%s",AQ_URL1,USER_PARAM.OPEN_WEATHER_LATITUDE,AQ_URL2,USER_PARAM.OPEN_WEATHER_LONGITUDE,AQ_URL3,USER_PARAM.OPEN_WEATHER_DKEY); - printf("%s\n",getURL); + // printf("%s\n",getURL); HTTPClient http; http.begin(getURL); @@ -719,7 +721,7 @@ int OpenWeatherOneCall::createCurrent(int sizeCap) int alertz = 0; sprintf(getURL,"%s?lat=%.6f&lon=%.6f&lang=%s%s&units=%s%s%s",DS_URL1,USER_PARAM.OPEN_WEATHER_LATITUDE,USER_PARAM.OPEN_WEATHER_LONGITUDE,USER_PARAM.OPEN_WEATHER_LANGUAGE,DS_URL2,units,DS_URL3,USER_PARAM.OPEN_WEATHER_DKEY); - + // printf("\n%s\n",getURL); HTTPClient http; http.begin(getURL); From 9fe57e530f3ab98c9eebc89039200b243d77d99f Mon Sep 17 00:00:00 2001 From: Jessica Hershey <60907719+JHershey69@users.noreply.github.com> Date: Tue, 30 Jul 2024 09:18:33 -0400 Subject: [PATCH 4/7] Update OpenWeatherOneCall.h 3.3.3 --- src/OpenWeatherOneCall.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OpenWeatherOneCall.h b/src/OpenWeatherOneCall.h index 6adf244..3e9decf 100644 --- a/src/OpenWeatherOneCall.h +++ b/src/OpenWeatherOneCall.h @@ -1,6 +1,6 @@ /* OpenWeatherOnecall.h - Upgrade v3.1.8 + Upgrade v3.3.3 copyright 2020 - Jessica Hershey www.github.com/jHershey69 From 202fe4e879b1b3b9b87c0a2240853631aced2a44 Mon Sep 17 00:00:00 2001 From: Jessica Hershey <60907719+JHershey69@users.noreply.github.com> Date: Tue, 30 Jul 2024 09:21:15 -0400 Subject: [PATCH 5/7] Update README.md 3.3.3 --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d6c06ab..370e0a8 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -# OpenWeatherOneCall v3.3.2 ![IMAGE OF LIGHTNING](https://github.com/JHershey69/OpenWeatherOneCall/blob/master/images/lightning.jpg) +# OpenWeatherOneCall v3.3.3 ![IMAGE OF LIGHTNING](https://github.com/JHershey69/OpenWeatherOneCall/blob/master/images/lightning.jpg) ## This is for ESP32 only -##This is an upgrade for OpenWeatherMap API 3.0 +##This is an upgrade for OpenWeatherMap API 3.0 and Air Pollution API 2.5 **Please be advised** OpenWeather has changed ONE CALL to a subscription service. Signing up is required to get your KEY, but you get 1000 calls a day for free (this is one call every 90 seconds and that is A LOT for free) @@ -55,5 +55,6 @@ v3.0.0 has a **Legacy Mode** to maintain ease of use for previous versions
--Minor fix to update API change.
**v3.3.2**
--Minor fix to update API change for Air Quality. - +
**v3.3.3** +
--Minor fix to update API change for Air Quality and Example scripts. From 3cc5461e9c85c5aa1351d71e0597caf76f3a93c4 Mon Sep 17 00:00:00 2001 From: Jessica Hershey <60907719+JHershey69@users.noreply.github.com> Date: Tue, 30 Jul 2024 09:29:30 -0400 Subject: [PATCH 6/7] Update Simple_Latitude_Longitude_Weather_Example.ino 3.3.3 --- ...ple_Latitude_Longitude_Weather_Example.ino | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/examples/Simple Latitude Longitude Weather/Simple_Latitude_Longitude_Weather_Example.ino b/examples/Simple Latitude Longitude Weather/Simple_Latitude_Longitude_Weather_Example.ino index 65f6414..e24eeb2 100644 --- a/examples/Simple Latitude Longitude Weather/Simple_Latitude_Longitude_Weather_Example.ino +++ b/examples/Simple Latitude Longitude Weather/Simple_Latitude_Longitude_Weather_Example.ino @@ -1,11 +1,9 @@ /* Open Weather One Call Library - v3.3.1 + v3.0.4 Copyright 2020 - Jessica Hershey www.github.com/JHershey69 - Sample Simple Longitude Latitude Weather Call updated 7/30/2024 to show Air Quality calls example - One Call API key at www.openweathermap.org Google Developer Key no longer required. @@ -32,9 +30,9 @@ TFT_eSPI tft = TFT_eSPI(); // Invoke custom library //========= End TFT Library ============================= -#define HOMESSID "SSID HERE" -#define HOMEPW "PASSWORD HERE" -#define ONECALLKEY "OPENWEATHER ONE CALL API KEY HERE" +#define HOMESSID "YOUR SSID HERE" +#define HOMEPW "YOUR SSID PW HERE" +#define ONECALLKEY "YOUR ONE CALL API KEY HERE" // Only needed if WiFiTri installed for Triangulation may have fee from Google #define GOOGLEKEY "YOUR GOOGLE DEVELOPER API KEY"" @@ -43,7 +41,7 @@ TFT_eSPI tft = TFT_eSPI(); // Invoke custom library // OpenWeatherOneCall variables //For Latitude and Longitude Location setting if used -float myLATITUDE = 39.9537; //<-----Toms River, NJ +float myLATITUDE = 39.9537; //<-----This is Toms River, NJ float myLONGITUDE = -74.1979; //For City ID Location setting if used @@ -55,7 +53,7 @@ int myUNITS = IMPERIAL; //<-----METRIC, IMPERIAL, KELVIN (IMPERIAL is d int myHISTORY = NULL; //<-----Only required for historical data up to 5 days //See manual for excludes, only CURRENT Data allows 1,000,000 calls a month -int myEXCLUDES = EXCL_A+EXCL_D+EXCL_H+EXCL_M; //<-----0 Excludes is default +int myEXCLUDES = EXCL_D+EXCL_H+EXCL_M; //<-----0 Excludes is default //for debugging loop counting @@ -159,7 +157,7 @@ void setup() { if(OWOC.quality) //See Addendum for complete list of Air Quality Variables { - printf("\nAir Quality\n"); + printf("\nAir Quality : % d\n", OWOC.quality->aqi); printf("Carbon : % .2f\n", OWOC.quality->co); printf("Nitrogen : % .2f\n", OWOC.quality->no); printf("Ozone : % .2f\n", OWOC.quality->o3); @@ -172,10 +170,11 @@ void setup() { if (OWOC.alert) //Only if ALERTS aren't excluded { - printf("ALERT *** ALERT *** ALERT\n"); + printf("\nALERT *** ALERT *** ALERT\n"); printf("Sender : % s\n", OWOC.alert->senderName); printf("Event : % s\n", OWOC.alert->event); printf("ALERT : % s\n", OWOC.alert->summary); + } else {printf("\nNo Alerts For Area\n"); } } From f30b27701fcaac8e1462ed869d9a3c30e03123ee Mon Sep 17 00:00:00 2001 From: Jessica Hershey <60907719+JHershey69@users.noreply.github.com> Date: Tue, 30 Jul 2024 09:32:58 -0400 Subject: [PATCH 7/7] Delete examples/v2 Examples directory --- .../SerialMonitorWeatherExample.ino | 186 ------------------ 1 file changed, 186 deletions(-) delete mode 100644 examples/v2 Examples/SerialMonitorWeatherExample.ino diff --git a/examples/v2 Examples/SerialMonitorWeatherExample.ino b/examples/v2 Examples/SerialMonitorWeatherExample.ino deleted file mode 100644 index c1cbf46..0000000 --- a/examples/v2 Examples/SerialMonitorWeatherExample.ino +++ /dev/null @@ -1,186 +0,0 @@ - -/* - Open Weather One Call Library - v1.2.0 - Copyright 2020 - Jessica Hershey - www.github.com/JHershey69 - - One Call API key at www.openweathermap.org - - SerialMonitorWeatherExample.ino - - Returns CURRENT and 7 DAY FORECAST - - Variables accessed as OWOC.current.temperature or OWOC.forecast[x].temperature (where x is day 0-6) - - All print commands in this example are to the Serial Monitor -*/ - -//WiFi Connection required -#include - -//Required libraries -#include -#include "HTTPClient.h" -#include -#include -#include - -//================================================== - -#define HOMESSID "YOUR SSID IDENTIFIER" -#define HOMEPW "YOUR SSID PASSWORD" - -#define ONECALLKEY "YOUR ONE CALL WEATHER MAP API KEY" -#define GOOGLEKEY "USE KEY FROM GOOGLE DEVELOPER FOR GEOLOCATION" - -// Sample City IDs ********************************** - -int city_id = 4504476; //<------------ Toms River, NJ -//int city_id = 4164138; // <------------ Miami, FL -//int city_id = 5128581; // <------------ New York City, NY -//int city_id = 1697175; // <------------- Olongapo, PH -//int city_id = 4142224; // <------------- Delaware, USA - - -// Sample Lat and Lon for Los Angeles -float myLatitude = 34.0522; //<-----------------------------in range to use GPS coordinates -float myLongitude = 118.2437; - -bool metric = false; //<------------------------------TRUE is METRIC, FALSE is IMPERIAL, BLANK is KELVIN - - -OpenWeatherOneCall OWOC; // <--------------------------- Invoke Library like this - -void connectWifi() { - - WiFi.begin(HOMESSID, HOMEPW); - - Serial.print("Connecting."); - - int TryNum = 0; - - while (WiFi.status() != WL_CONNECTED) { - Serial.print("."); - delay(200); - TryNum++; - if (TryNum > 20) { - Serial.println("Unable to connect check your parameters."); - for (;;); - } - } - - - Serial.print("Connected to: "); - Serial.println(HOMESSID); - - -} //======================== END WIFI CONNECT ======================= - - - - -void setup() { - // put your setup code here, to run once: - Serial.begin(115200); - while (!Serial) { - ; - } - Serial.println("Serial Monitor Initialized"); - - while (WiFi.status() != WL_CONNECTED) { - connectWifi(); - } - - - //================================= - // Get the Weather Forecast - //================================= - - // Examples of calls: - - // For manual coordinates or GPS - // OWOC.parseWeather(ONECALLKEY, NULL, myLatitude, myLongitude, excludes, metric, NULL,EXCLUDES,HISTORICAL) - - // For GEOLOCATION BASED ON WiFi - // OWOC.parseWeather(ONECALLKEY, GOOGLEKEY, NULL, NULL, excludes, metric, NULL, EXCLUDES, HISTORICAL) - - // For call by City ID (active as of v1.2.0) - // OWOC.parseWeather(ONECALLKEY, NULL, NULL, NULL, excludes, metric, city_id, EXCLUDES, HISTORICAL) - - /* - EXCLUDES ARE: - EXCL_C(urrent) EXCL_D(aily) EXCL_H(ourly) EXCL_M(inutely) EXCL_A(lerts) - In the form EXCL_C+EXCL_D+EXCL_H etc - NULL is EXCLUDE NONE (Send ALL Info) - */ - - /* - Historical Data is for the last 1-5 days - NULL returns NO HISTORICAL DATA - HISTORICAL Data overrides Current and is the ONLY data returned - Change the below argument to number of days prior desired - 24 hours returned - So, if today is Friday and you want Wednesday use 2 - */ - -int HISTORICAL = 1; //<--------------------- set to # days for Historical weather, NULL for current - - OWOC.parseWeather(ONECALLKEY, NULL, NULL, NULL, metric, city_id, EXCL_H + EXCL_M, HISTORICAL); //<---------excludes hourly, minutely, historical data 1 day - - - - if (!HISTORICAL) - { - - //================================================= - // Print 7 day High Temp results to Serial Monitor - //================================================= - - - Serial.println(OWOC.current.temperature); - - Serial.println(""); - Serial.println("7 Day High Temperature Forecast:"); - - for (int y = 0; y < (sizeof(OWOC.forecast) / sizeof(OWOC.forecast[0])) - 1; y++) { - //Date from epoch forecast[y].dayTime - long DoW = OWOC.forecast[y].dayTime / 86400L; - int day_of_week = (DoW + 4) % 7; - - Serial.print(OWOC.short_names[day_of_week]); - Serial.print(": "); - Serial.println(OWOC.forecast[y].temperatureHigh); - } - - Serial.println(""); - Serial.println("**********ALERTS********"); - Serial.print("From: "); - Serial.println(OWOC.alert[0].sender_name); - Serial.print("Event: "); - Serial.println(OWOC.alert[0].event); - }else{ - Serial.print("Historical Temperature for DATE requested: "); - Serial.println(OWOC.history[0].temp); - Serial.print("00:00 Hour Historical Temperature for DATE requested: "); - Serial.println(OWOC.history[1].temp); - Serial.print("01:00 Hour Historical Temperature for DATE requested: "); - Serial.println(OWOC.history[2].temp); - - } - /* - Serial.println("**********MINUTELY Precipitation**************"); - - for (int y = 0;y<61;y++) - { - Serial.print("Minute "); - Serial.print((y)); - Serial.print(": "); - Serial.println(OWOC.minute[y].precipitation); - } - */ -} - -void loop() { - // put your main code here, to run repeatedly: - -}