Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hangup of the Logging when Internet connection is shortly interrupted #8

Open
kipet1 opened this issue Sep 19, 2022 · 5 comments
Open

Comments

@kipet1
Copy link

kipet1 commented Sep 19, 2022

Hi,
i am logging my home energy data with ESP8266 into Google sheets with httpsredirect, following the directions given in:
https://github.com/StorageB/Google-Sheets-Logging

My ESP goes in hangup occasionally when the internet gets interrupted shortly.
The Wemos D1 gets stuck exactly during
if(client->POST(url, host, payload)){
No error message, I can only pull it out by hard reset.

I was already playing days with the watchdog of the ESP, as this should act to pull it out or restart the device. But this is only partially successful, for some unknown strange reason, the watchdog is not always recognizing it. I didn't succeed to get a reliable logging, which is important, not to loose too many data of my home energy monitoring, including future solar power charge control of electric car.

I would appreciate, if there could be done some improvement inside the httpsredirect of error handling, or implementation of a timeout (e.g 10sec), if the post is not finalized after this time.
Thanks, regards, Peter

@github-actions
Copy link

Welcome to HTTPSRedirect! Please provide enough info to debug the issue.

@kipet1
Copy link
Author

kipet1 commented Sep 19, 2022

Here is the part of the code:

`void sendtoGoogle() {
static bool flag = false;
if (!flag){
client = new HTTPSRedirect(httpsPort);
client->setInsecure();
flag = true;
client->setPrintResponseBody(true);
client->setContentTypeHeader("application/json");
}
if (client != nullptr){
if (!client->connected()){
client->connect(host, httpsPort);
}
}
else{
Serial.println("Error creating client object!");
}

// Create json object string to send to Google Sheets
payload = payload_base + """ + Power0 + "," + Power1 + "," + Power2 + "," + Etotret0 + "," + Etot1 + "," + Etot2 + ""}";

Serial.println(WiFi.status());

ESP.wdtFeed();

Serial.print("Publishing.. " );
Serial.println(millis()-start_10S);

if(client->POST(url, host, payload)){ //<---------------------- Hangup in case of internet connection interruption
Serial.print(" "); Serial.println(millis()-start_10S);
}
else{
// do stuff here if publish was not successful
Serial.println("Error while connecting");
}

Serial Monitor:
14:15:20.404 -> Start Shelly 3
14:15:20.457 -> Publishing.. 61
14:15:23.953 -> Success
14:15:23.953 -> 3556 <- successfull publish, repeated each 15 seconds, the post lasts about 3.5sec

14:15:35.437 -> Start Shelly 3 <- shortly before the internet connection starts interruption for about 10 seconds
14:15:35.500 -> Publishing.. 60 <- Here it hangs forever inside POST....

@kipet1 kipet1 closed this as completed Sep 19, 2022
@kipet1 kipet1 reopened this Sep 19, 2022
@kipet1
Copy link
Author

kipet1 commented Sep 26, 2022

Any comment would be appreciated

@ahmdgamaljimy95
Copy link

hi @kipet1 did you solve this issue ?
i have this problem and cant solve it till now ?

@kipet1
Copy link
Author

kipet1 commented Dec 28, 2022

Hi,
as i did not get any answer here from electronicsguy, i discussed this issue in other posts and found the solution, see here:
StorageB/Google-Sheets-Logging#7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants