sinricpro / esp8266-esp32-sdk

Library for https://sinric.pro - simple way to connect your device to Alexa, Google Home, SmartThings and cloud
https://sinric.pro
Other
234 stars 124 forks source link

Reliabilty #65

Closed khorner116 closed 4 years ago

khorner116 commented 4 years ago

Hey team... thanks for all the great work. I've had one disconnect issue with the system that's in place and running. Overall, it works fine. But it did hang the other day. Dumping the log file, I noted that the connection to the Sinric server dropped and was not restarted until I rebooted the ESP32. I can't tell from my logs if it was my wifi that went off the air or the link to the server that dropped--I need more granular logging I guess. But I still need a solution. Should I put a test of WL_CONNECTED in the code on a 1 minute loop or something? And maybe put code in SinricPro.onDisconnected() to trip a flag and cause a reboot? Let me know your thoughts.

Thanks. Ken

sivar2311 commented 4 years ago

Hey Ken Normally this is handled automatically by the SDK.

There are 2 cases that the SDK can handle:

1) WiFi signal is lost: The SDK detects this very quickly and starts reconnecting to the SinricPro server when WiFi is available again.

2) The WiFi signal is available, but the Internet connection is lost: The SDK detects this using the websocket ping/pong mechanism. It can take up to 5 minutes to detect this type of connection loss. After the disconnection is detected, the SDK automatically starts to reconnect.

khorner116 commented 4 years ago

Thanks Boris. That's what I thought, but it was offline for about a day and took a full power down (pulled backup battery) and back up to get Alexa to figure out the devices were there. And, they showed "red" on the Sinric dashboard until the power cycle. The software loop itself won't hang. The watch dog timer trips after two secs and resets. I'll see if I can simulate another failure. Maybe get some better info. I want this thing to work remotely without too much trouble or hand holding.

On Sat, May 23, 2020 at 4:08 AM Boris Jäger notifications@github.com wrote:

Hey Ken Normally this is handled automatically by the SDK.

There are 2 cases that the SDK can handle:

1.

WiFi signal is lost: The SDK detects this very quickly and starts reconnecting to the SinricPro server when WiFi is available again. 2.

The WiFi signal is available, but the Internet connection is lost: The SDK detects this using the websocket ping/pong mechanism. It can take up to 5 minutes to detect this type of connection loss. After the disconnection is detected, the SDK automatically starts to reconnect.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sinricpro/esp8266-esp32-sdk/issues/65#issuecomment-633004810, or unsubscribe https://github.com/notifications/unsubscribe-auth/AICQSLOVM4YIEGQSDUCKCR3RS6AARANCNFSM4NIDBICA .

sivar2311 commented 4 years ago

I did a test for both situations and the automatic reconnect worked. Something else must happened to your device. The idea about using SinricPro.onDisconnected() is good. Set a flag on a disconnect event, and if there is no reconnect within 6 minutes, do a reset.

sivar2311 commented 4 years ago

closed due to inactivity

sivar2311 commented 4 years ago

Late, but i've got another idea that might help here: You can try WiFi.setAutoReconnect(true); see here