Skip to content

Server connection troubles #261

@khorner116

Description

@khorner116

I am having an intermittent problem with my IOT setup. It has been running and upgraded at various times over the past two years. Recently, it has had trouble connecting to the Sinric server. On maybe 1 in 5 resets it hangs.

The code has defined the SinricPro.onConnected( function within a startup routine...

SinricPro.onConnected({
if(DisplayOnConsole)Serial.printf("Connected to SinricPro\r\n");
tft_scroll("..SinricPro connected",3);
Sinric_connected=true;}); // Set this flag to let the rest of the code know

And once it executes the statement it flows into a waiting loop.
SinricPro.begin(APP_KEY, APP_SECRET);
delay(1000);
FailTime=millis();
while (!Sinric_connected) { // Hold in this loop until
if(DisplayOnConsole)Serial.printf("."); // we reconnect or we let the watch
timerWrite(timer1, 0); // dog timer trip after a 5 min delay.
SinricPro.handle();
delay(250);
if((millis()- FailTime) >300000) while(1); // Watch dog times out here
} }

As shown above, the code following the Begin statement loops and calls the handler till the Sinric_connected variable becomes true.

This works almost all the time, but occasionally it will hang forever. As shown above, I've recently implemented a watchdog timer routine to let it hang for 5 minutes and then reboot the ESP32, But sometimes even a complete restart doesn't clear the issue. After a 1/2 hour or so it seems to go away. I'm looking for insight into the issue. Should I be doing some sort of formal disconnect (like I do for the WIFI startup). Or what? Ideas please.

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleIssue that may be closed soon due to the original author not responding any more.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions