G6EJD / ESP32-e-Paper-Weather-Display

An ESP32 and 2.9", 4.2" or 7.5" ePaper Display reads Weather Underground data via their API and then displays the weather
Other
959 stars 206 forks source link

Need an independent API-Call Function #262

Open Zurrmaxe opened 3 weeks ago

Zurrmaxe commented 3 weeks ago

Hello Friends I also use the display for my solar display. To do this, WiFi and the ESP32 must not be switched off and word 24 Hours. To do this, I switched off all the SLEEP functions in this ePaper-code.

But now, the weather update doesn't work anymore.

Now i want to start the weather API manually every 30 minutes with my own code Therefore i need the "codeword" or StringText or first step to start the weatherupdate once. I can handle the rest (Timer , if then else ...pp) of the code. My wish:

ESP32+Display only 23.00 to 06.00 sleeping Weather-API update every 30 Minutes from 06.00 to 23.00

Alfred

Alfred

G6EJD commented 2 weeks ago

You can’t do that, just make the ESP32 go to Deep Sleep then set to same 30-mins later or over night for the required number of hours, so definite two timer values 30-mins snd 8-hours or whatever you need.

Zurrmaxe commented 2 weeks ago

I have an 7inch Display and want to show the weatherstation, the power of my solarpanels and the power consumtion of my house. So the esp32 and the WiFi.init are always "on" to get the JSON-Files from the solar-stations and the shelly EM every 2 to 4 seconds. In this case, the weatherstation get no OWM updates. I must resart the OMW manualy like this:

void timestart() { //ESP Restart every 01 and 31 Minutes of an houre if(timeClient.getMinutes() == OnMin){ // DisplayWeather(); ESP.restart(); } else if (timeClient.getMinutes() == OnMinA){ //DisplayWeather(); ESP.restart(); }

}

But then, the Screen always flickers when the ESP32 wake up or restart . So im looking for a code to start only the OWM update without starting the ESP.

G6EJD commented 2 weeks ago

Just make sure the WiFi is connected, then: WiFiClient client; // wifi client object while ((RxWeather == false || RxForecast == false) && Attempts <= 2) { // Try up-to 2 time for Weather and Forecast data if (RxWeather == false) RxWeather = obtain_wx_data(client, "weather"); if (RxForecast == false) RxForecast = obtain_wx_data(client, "forecast"); Attempts++; } if (RxWeather && RxForecast) { // Only if received both Weather or Forecast proceed StopWiFi(); // Reduces power consumption DisplayWeather(); display.display(false); // Full screen update mode }

That will get new data and display it. BUT be warned, OWM has introduced since yesterday strict controls on API access limited to 1000/day after which you have to pay for access, so make a request more than every 2-mins and they will block your account or charge you. You need to sign up for a new API key too.