ThingPulse / esp8266-weather-station

ESP8266 Weather Station library supporting OpenWeatherMap, Aeris and other sources
MIT License
1.06k stars 359 forks source link

[HTTP] lost in client with a timeout #209

Open louisvarley opened 1 year ago

louisvarley commented 1 year ago

Expected behavior

Downloading of Forecast Data

Actual behavior

I've been using this library in a project for some time, unsure if due to a change at OpenWeather but suddenly i get [HTTP] lost in client with a timeout and box restarts,

Test code

My Get Data Code here, current weather is fine, but Forecast will always fail, i'm only doing a max of 3 days

void getWeatherData()                             
{

  Serial.println("Getting Weather from OpenWeather");  

  Serial.println("Getting Current Forecast from OpenWeather"); 
  currentWeatherClient.setMetric(IS_METRIC);
  currentWeatherClient.setLanguage(OPEN_WEATHER_MAP_LANGUAGE);
  currentWeatherClient.updateCurrentById(&currentWeather, OPEN_WEATHER_MAP_APP_ID, OPEN_WEATHER_MAP_LOCATION_ID);

  Serial.println("Getting Future Forecast from OpenWeather"); 

  forecastClient.setMetric(IS_METRIC);
  forecastClient.setLanguage(OPEN_WEATHER_MAP_LANGUAGE);
  uint8_t allowedHours[] = {0,12};
  forecastClient.setAllowedHours(allowedHours, 2);
  uint8_t foundForecasts = forecastClient.updateForecastsById(forecasts, OPEN_WEATHER_MAP_APP_ID, OPEN_WEATHER_MAP_LOCATION_ID, MAX_FORECASTS);

  Serial.println("Done Getting Weather from OpenWeather"); 

}

Changing this in OpenWeatherMapForecast.cpp and it runs as expected again

unsigned long lostTest = 20000UL;

I know that the speed it will be downloading the JSON response would be due to speed of WiFi / Internet, i have Ubiquti APs, Fibre and ESP8266 is in the same room as an AP. Started very suddenly about a week ago

Maybe make it so we can change this value outside of the library?

Weather Station version

Master

Hardware

Custom Hardware, a Clone ESP8266, with a matrix display

marcelstoer commented 1 year ago

We sure would object to a PR making the OWM HTTP timeout - that's what the oddly named lostTest really is - available as a user setting with a sensible default.

marcelstoer commented 1 year ago

We sure would object

Oh bummer, only just noticed. That should of course be "would NOT object".

louisvarley commented 1 year ago

;) I did wonder. I was like "oh... ok"

I did make the change to hard code it on my weather station but Ill see what I can do.

Sent from Outlook for Androidhttps://aka.ms/AAb9ysg


From: Marcel Stör @.> Sent: Thursday, January 19, 2023 7:56:25 PM To: ThingPulse/esp8266-weather-station @.> Cc: SEALTeamRicks @.>; Author @.> Subject: Re: [ThingPulse/esp8266-weather-station] [HTTP] lost in client with a timeout (Issue #209)

We sure would object

Oh bummer, only just noticed. That should of course be "would NOT object".

— Reply to this email directly, view it on GitHubhttps://github.com/ThingPulse/esp8266-weather-station/issues/209#issuecomment-1397523771, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AHHYVZ3B3PIAKEZTBD62W7TWTGL6TANCNFSM6AAAAAAS2ORTRI. You are receiving this because you authored the thread.Message ID: @.***>