OPENWEATHER call not working on ESP32 with Edgent but works fine on Serial connection

I am running ESP32 Devkit v1, Arduino IDE and Blynk 2.0 with Edgent.

I have an Openweather API Call that has worked well for last 18 months on both Blynk1.0 and up until today on Blynk2.0 (Serial connection)
When I then added Edgent, (Which works brilliantly), although I didn’t change any of the working code, the serial monitor showed me that the call too the Openweather API was not happening. Clearly something to do with wifi credentials etc. I have read a number of similar posts and support that has been given on similar topics but got a bit lost in the Documentation, discussion on web hooks etc and I suspect it is something fairly simple (Adding in some other libraries, or accessing wifi credentials or checking for connection?)

I have extracted the relevant code below (but excluded the any other functions, declarations etc all of which is working fine. The open weather call stopped producing results as soon as I went to Edgent. Happy to post the full code if required (But it is very long - clearly need to separate this out into other files but still debugging and working through the logic including trying to then rewrite in to a future state machine!)

#define BLYNK_TEMPLATE_ID "TMPL6DiA3dgE"
#define BLYNK_DEVICE_NAME "Herb Garden"
#define BLYNK_FIRMWARE_VERSION        "0.1.9"
#define BLYNK_PRINT Serial
#define APP_DEBUG

//LIBRARIES
#include "DHT.h"
#include "BlynkEdgent.h"
#include <OpenWeatherOneCall.h>
//--------------------------------------------------
// Define OneCall API KEY and invoke the library
//--------------------------------------------------

#define ONECALLKEY "RedacateKeyGoesHere" //my private key for the openweather API calls. Redacted for security!
OpenWeatherOneCall OWOC;

/--------------------------------------------------
// Define 12v Pump, Solenoid and Virtual Pins
//--------------------------------------------------
#define WATER_PUMP_PIN 23  //D23
#define WATER_SOLENOID_PIN 13
#define VPIN_BUTTON_1    V1
#define VPIN_BUTTON_2    V2
#define VPIN_BUTTON_C  V9
#define VPIN_IS_IT_RAINING  V12
#define VPIN_RAIN_LAST_FIVE  V40
#define VPIN_RAIN_LAST_HOUR  V41
#define VPIN_RAIN_TODAY   V42
#define VPIN_DESIRED_MOISTURE  V77

// Relay State
bool toggleState_1 = LOW; //Define integer to remember the toggle state for relay 1
bool toggleState_2 = LOW; //Define integer to remember the toggle state for relay 2


//------------------------------------------
//  Oneweather forecast and icons function
//------------------------------------------
void setBlynkWeather() {

  int status = WL_IDLE_STATUS;
  char server[] = "api.openweathermap.org";
  String location = "Reading, UK";

  // OpenWeatherOneCall variables
  float myLATITUDE = 51.51119916275342;               //<-----Crowsley, Henley-on Thames
  float myLONGITUDE = -0.9597222296547302;           //<-----Crowsley, Henley-on-Thames
  int myCITYID = 2639577;                            //For City ID Location setting if used - READING
  int myUNITS = METRIC;                               //<-----METRIC, IMPERIAL, KELVIN (IMPERIAL is default)
  int myHISTORY = NULL;                               //<-----Only required for historical data up to 5 days. NULL means no historical data as cant get current and historical
  int myEXCLUDES = EXCL_C + EXCL_D + EXCL_M + EXCL_A; //<-----0 Excludes is default. EXCL_C=Current; EXCL_H= Hour; EXCL_M = Minutes; EXCL_A= ALerts

  //for debugging loop counting
  int nextCall = 0;

  // First set My Open Weather Key value
  OWOC.setOpenWeatherKey(ONECALLKEY);

  // Second set my position (can be CITY ID, IP ADDRESS, GPS, or Manual LATITUDE/LONGITUDE)
  OWOC.setLatLon(myLATITUDE, myLONGITUDE);
  OWOC.setDateTimeFormat(DMY24H);
  OWOC.setExcl(myEXCLUDES);         // Third set any EXCLUDES if required
  OWOC.setHistory(myHISTORY);       // Set History if you want historical weather but I am defaulting to Null
  OWOC.setUnits(myUNITS);           // Set UNITS of MEASURE to Metric otherwise default is IMPERIAL

  //Now call the weather.
  OWOC.parseWeather();//.
  printf("\nLocation: % s, % s % s\n", OWOC.location.CITY, OWOC.location.STATE, OWOC.location.COUNTRY);       //Now display some information
  Blynk.virtualWrite(V33, OWOC.location.CITY);                                                               //update the dashboard to show we are pulling the right weather

  //Verify all other values exist before using. Remember you can't get historical and current weather at the same time
  if (myHISTORY) {
    if (OWOC.history) {
      printf("Mean Temp for % s : % .0f\n", OWOC.history[0].weekDayName, OWOC.history[0].temperature);
    }
  } else {
    if (OWOC.current) {
      printf("Current icon is :  %s\n", OWOC.current->icon);
    }

    if (OWOC.hour) {                //update for todays weather
      Blynk.virtualWrite(V24, (OWOC.hour[0].pop));
      Blynk.virtualWrite(V21, (OWOC.hour[0].temperature));
      Blynk.virtualWrite(V22, (OWOC.hour[0].apparentTemperature));
      Blynk.virtualWrite(V23, (OWOC.hour[0].pressure));
      // Blynk.virtualWrite(V25, (OWOC.hour[0].dayTime));
      Blynk.virtualWrite(V26, (OWOC.hour[0].summary));
      Blynk.virtualWrite(V30, (OWOC.hour[0].windSpeed));
      Blynk.virtualWrite(V31, (OWOC.hour[0].windBearing));
      Blynk.virtualWrite(V32, (OWOC.hour[0].dewPoint));
      Blynk.virtualWrite(V34, (OWOC.hour[0].rainVolume));

      printf("temp H is: % .2f\n",  OWOC.hour[0].temperature);
      printf("pressure is:  % .0f\n",  OWOC.hour[0].pressure);
      printf("summary is:  % s\n",  OWOC.hour[0].summary);
      printf("windspeed is:  % .0f\n", (OWOC.hour[0].windSpeed));
      printf("windbearing is:  % .0f\n", (OWOC.hour[0].windBearing));
      printf("dewpoint is:  % .2f\n", (OWOC.hour[0].dewPoint));
      printf("Chance of rain% is:  % .2f\n", (OWOC.hour[0].pop));
      printf("icon case number is:  % .0f\n",  OWOC.hour[0].id);
    }

    if (OWOC.alert) {
      printf("ALERT *** ALERT *** ALERT\n");
      printf("Sender : % s\n", OWOC.alert->senderName);
      printf("Event : % s\n", OWOC.alert->event);
      printf("ALERT : % s\n", OWOC.alert->summary);
    }
  }
}

BlynkTimer timer;
   //------------------------------------------
    //Main Setup Function
    //------------------------------------------
    void setup(){
    pinMode(WATER_PUMP_PIN, OUTPUT);
    pinMode(WATER_SOLENOID_PIN, OUTPUT);
    pinMode(REED_PIN, INPUT_PULLUP);
    pinMode(TRIG_PIN, OUTPUT); // Sets the trigPin as an Output
    pinMode(ECHO_PIN, INPUT); // Sets the echoPin as an Input
    attachInterrupt(digitalPinToInterrupt(REED_PIN), reedSwitch_ISR, FALLING); // <----- changed to this line
    //During Starting all Relays should TURN OFF

    Serial.begin(115200);
    dht.begin();
    digitalWrite(WATER_PUMP_PIN, HIGH);
    digitalWrite(WATER_SOLENOID_PIN, HIGH);
    BlynkEdgent.begin();
    timer.setInterval(1000L, readDHTSensor);
    timer.setInterval(1000L, setMoistureReading);
    timer.setInterval(1000L, RainfallTippingBucket);
    timer.setInterval(15000L, getButtWaterLevel);
    setBlynkWeather();
}

void loop() {
  BlynkEdgent.run();
  timer.run();
}

It’s extremely difficult to make any sense of this without seeing the entire .ino file.

Maybe your first step should be to just add the openweather part of the code to the Edgent example sketch and test from there, and if you can’t get it working then then post your full sketch and serial output.

Pete.

Ok- Ithanks, can give that a go tomorrow. The .ino file is very long so i excluded all of the functions that simply aren’t relevant to the issue for expediency. As I said, this has been working perfectly for 18 months, and worked perfectly on Blynk2.0 for a traditional serial upload. so it is clearly something i have forgotten to include in the Edgent version of the sketch. I’ll play more tomorrow morning.