Google-Sheets-Logging icon indicating copy to clipboard operation
Google-Sheets-Logging copied to clipboard

Hangup of the Logging when Internet connection is shortly interrupted

Open kipet1 opened this issue 1 year ago • 11 comments

HI, my logging goes in hangup occasionally (1-2 times /week), this is boring. The Wemos gets stuck exactly during if(client->POST(url, host, payload)){ It happens, when exactly during post the internet gets disconnected for a short while. My router makes each day a reconnect with interruption of connection to get a new IP. It is not so rare, that this is falling just into the post procedure, as this takes about 3 seconds, each 15seconds. Before the post i get the info "Publishing ...", then nothing happens anymore, it stays forever, no return of Success or error message. (Before post Wifi and client was connected) I need to reset the Wemos to restart.

Does anybody have an idea of rootcause and/or countermeasure?

This is my code of that part, like in your example:

// Publish data to Google Sheets

int retval = client->connect(host, httpsPort); Serial.print("Client: ");Serial.println(retval); Serial.println(WiFi.status());

Serial.println("Publishing..."); //Serial.println(payload); if(client->POST(url, host, payload)){ Serial.println("successful"); } else{ // do stuff here if publish was not successful Serial.println("Error while connecting"); }

kipet1 avatar Sep 06 '22 15:09 kipet1

Process2 on ebay sells a watchdog timer kit for around 10 dollars.

On Tue, Sep 6, 2022 at 11:02 AM kipet1 @.***> wrote:

HI, my logging goes in hangup occasionally (1-2 times /week), this is boring. The Wemos gets stuck exactly during if(client->POST(url, host, payload)){ It happens, when exactly during post the internet gets disconnected for a short while. My router makes each day a reconnect with interruption of connection to get a new IP. It is not so rare, that this is falling just into the post procedure, as this takes about 3 seconds, each 15seconds. Before the post i get the info "Publishing ...", then nothing happens anymore, it stays forever, no return of Success or error message. I need to reset the Wemos to restart.

Does anybody have an idea of rootcause and/or countermeasure?

This is my code of that part, like in your example:

// Publish data to Google Sheets

int retval = client->connect(host, httpsPort); Serial.print("Client: ");Serial.println(retval); Serial.println(WiFi.status());

Serial.println("Publishing..."); //Serial.println(payload); if(client->POST(url, host, payload)){ Serial.println("successful"); } else{ // do stuff here if publish was not successful Serial.println("Error while connecting"); }

— Reply to this email directly, view it on GitHub https://github.com/StorageB/Google-Sheets-Logging/issues/7, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABWXSN5GAGT6CWVBY6R4XOLV45MJTANCNFSM6AAAAAAQF5MEO4 . You are receiving this because you are subscribed to this thread.Message ID: @.***>

rret avatar Sep 06 '22 15:09 rret

I was assuming, something could be done inside the google script, but it is no more in the loop, when the hangup occurs. Your watchdog suggestion brought me to the solution. The ESP8266 has a SW and HW watchdog on board, but they have strong limitations and do not work straightforward. I disabled the SW watchdog with
ESP.wdtDisable(); //SW WD disable, only HW And reset (feed) the HW WD every loop round and before the POST request.
ESP.wdtFeed(); This pulls it out from hangup after about 8sec. I was not sure, if this works, but it solves the issue. Thanks, regards Peter

kipet1 avatar Sep 09 '22 13:09 kipet1

good job. good to hear!

On Fri, Sep 9, 2022 at 9:16 AM kipet1 @.***> wrote:

I was assuming, something could be done inside the google script, but it is no more in the loop, when the hangup occurs. Your watchdog suggestion brought me to the solution. The ESP8266 has a SW and HW watchdog on board, but they have strong limitations and do not work straightforward. I disabled the SW watchdog with ESP.wdtDisable(); //SW WD disable, only HW And reset (feed) the HW WD every loop round and before the POST request. ESP.wdtFeed(); This pulls it out from hangup after about 8sec. I was not sure, if this works, but it solves the issue. Thanks, regards Peter

— Reply to this email directly, view it on GitHub https://github.com/StorageB/Google-Sheets-Logging/issues/7#issuecomment-1241964546, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABWXSN2IXEQC2BJRLSD474DV5M2EDANCNFSM6AAAAAAQF5MEO4 . You are receiving this because you commented.Message ID: @.***>

rret avatar Sep 10 '22 13:09 rret

Hi, unfortunately it turned out, that the solution with the WD is not working reliably. Testing it at the beginning 2 times by manually interrupting the DSL, it worked perfect, and i was happy. But it turns out, that it gets still locked sometimes at the POST request. I do not yet have any clue, why the watchdog is not biting reliable, still searching for a solution. In the moment, the internet gets short interruptions several times during the night, maybe some maintenence. Every night i got one hangup.

kipet1 avatar Sep 14 '22 16:09 kipet1

Get an external WDT. Process2 on ebay. Like 10 bucks including shipping. Good luck.

On Wed, Sep 14, 2022, 12:44 PM kipet1 @.***> wrote:

Hi, unfortunately it turned out, that the solution with the WD is not working reliably. Testing it at the beginning 2 times by manually interrupting the DSL, it worked perfect, and i was happy. But it turns out, that it gets still locked sometimes at the POST request. I do not yet have any clue, why the watchdog is not biting reliable, still searching for a solution. In the moment, the internet gets short interruptions several times during the night, maybe some maintenence. Every night i got one hangup.

— Reply to this email directly, view it on GitHub https://github.com/StorageB/Google-Sheets-Logging/issues/7#issuecomment-1247036667, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABWXSN3GDTE3KE6JLPELI23V6H6FDANCNFSM6AAAAAAQF5MEO4 . You are receiving this because you commented.Message ID: @.***>

rret avatar Sep 14 '22 18:09 rret

Hi rret, as this issue is still pending, and also the electronicguy for the httpsdirect library does not answer, please give me some more info about your recommended WDT. The price is not the big issue, but the work to add it into my device inside the case. I cannot find such a thing on ebay. I only find a 3 pin device DS1233, which supervises the supply as watchdog, not really suitable. Thanks, Peter

kipet1 avatar Sep 22 '22 10:09 kipet1

see here: https://process2.net/ also here: https://www.ebay.com/itm/144707052822

Your code basically sends a heartbeat to the WDT. If the WDT doesn't get a HB, it sets a pin on the WDT to low, which you can use to reset your microprocessor. Hope that helps. Let me know if any questions. Thank you.

On Thu, Sep 22, 2022 at 6:31 AM kipet1 @.***> wrote:

Hi rret, as this issue is still pending, and also the electronicguy for the httpsdirect library does not answer, please give me some more info about your recommended WDT. The price is not the big issue, but the work to add it into my device inside the case. I cannot find such a thing on ebay. I only find a 3 pin device DS1233, which supervises the supply as watchdog, not really suitable. Thanks, Peter

— Reply to this email directly, view it on GitHub https://github.com/StorageB/Google-Sheets-Logging/issues/7#issuecomment-1254834722, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABWXSNYVAIYZOUWZHXPBJFTV7QYQBANCNFSM6AAAAAAQF5MEO4 . You are receiving this because you commented.Message ID: @.***>

rret avatar Sep 22 '22 13:09 rret

Thanks for your information. I couldn't find it, because process2 does not sell to germany. Also the circuit looks not really smart, with a huge cap. I have the idea now, to put a second Wemos 8266 on top of it, the pins are then compatible, they superwise each other. It sounds like an overkill, but this is much cheaper, fully programmable, and smaller.

kipet1 avatar Sep 22 '22 19:09 kipet1

good luck!

On Thu, Sep 22, 2022 at 3:42 PM kipet1 @.***> wrote:

Thanks for your information. I couldn't find it, because process2 does not sell to germany. Also the circuit looks not really smart, with a huge cap. I have the idea now, to put a second Wemos 8266 on top of it, the pins are then compatible, they superwise each other. It sounds like an overkill, but this is much cheaper, fully programmable, and smaller.

— Reply to this email directly, view it on GitHub https://github.com/StorageB/Google-Sheets-Logging/issues/7#issuecomment-1255471084, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABWXSN5A75OD56RFYGAS2ODV7SZAXANCNFSM6AAAAAAQF5MEO4 . You are receiving this because you commented.Message ID: @.***>

rret avatar Sep 23 '22 12:09 rret