I am using an ESP32 board and have followed the tutorial to get it connected to wifi. I am also using Bluetooth to supply the WiFi credentials and verify the device on losant for authorization and then supply the access keys back to the board for connection to losant.
All this works great, WiFI connects but the problem is the device connects to Losant only briefly and gets disconnected almost immediately which results in the device being stuck in the connection wait loop.
I have tried various different posts and answers on this forum but not able to figure out the issue.
I am using the latest losant mqtt module for arduino.
Device just logs Connecting to Losant… and then just …
I maybe doing something wrong but sometimes it does seem to work but then the device again disconnects. Attaching screenshot from the code that i have currently.
@anaptfox I am actually following that tutorial. The problem is when i run the esp32.ino sketch without modifying anything with just my device id and keys hardcoded. Everything seems to work as expected.
But in my use case, i am authenticating through ble and transferring the keys, deviceId over ble to the device and making an attempt to connect to losant.
I moved to platformio and i have got a log that seems to be originating from the underneath ssl client, not sure what is causing the issue here.
Also, to help, we are working on a new guide for connecting the ESP32 to Losant using the ESP-idf to provide a solid example. We’ll follow up on this post when that is complete.
What is strange is that sometimes it does work as expected and connects perfectly without being disconnected but then that is 1 out of 3 tries. Not sure what is the core issue, i will keep looking into it to see if there is a memory or heap availability issue on it.
Hi @anaptfox - any chance this could be impacting the ESP8266 platform? I am experiencing the disconnect after adding some more data to my report section.
Actually, I have figured out what is causing my issue. It seems that any more than nine items cannot be reported at one time. My workaround was to create a unique report function for each group of data and send the reports individually.