nightduck/stormWatch

Node randomly disconnects from AWS

nightduck opened this issue · 4 comments

At some point, the AWS MQTT client will stop showing messages received, then the device will eventually throw an error on publication. Reconnecting shows an repeated error on the UART:

.[E][ssl_client.cpp:87] start_ssl_client(): Connect to Server failed!
[E][WiFiClientSecure.cpp:132] connect(): start_ssl_client: -1

When this error stops, a single message will be published, and no more. The node will act like everything is fine, "successfuly" publishing messages, but none show up in the AWS MQTT client

See failed attempt to resolve this at ee25f50

Possibly related to these errors: here and here.

Perhaps association sleep patterns are not actually implemented, so Wifi disconnects

Wifi is not the issue. The TLS connection to the AWS endpoint keeps dropping

New strat: refactor code to create a new connection on each wakeup and close that connection. Not as energy efficient as I'd like, but neither is spending 10 seconds dealing with ssl errors on each wakeup.

If wifi is shutdown before each sleep, and then everything has to reconnect on each wakeup, the wakeup lasts about 3-6 seconds. But in this mode, the node will last 6 hours from full charge to 3.7V plateau. Inspecting the voltage curve of LiPo batteries, that means a full charge should last 60-72 hours. Disable LEDs and we could go longer

e0367ee