[Solved] ESP8266 Losant Connection Closing intermittently



Please team, kindly help me. my esp8266 NodeMCU 12E always loose connection to losant. But when i restart/reset it connects back and keeps working. later after some few minutes it disconnects again.

What can i do to resolve it, could the DHT22 values is too much to accomodate by the esp? please help me. I have changed the mqtt size in pubsubclient to 256. what could still be the problem please help me.



Hi @Johnson_Isaac,

It could be a number of things (internet connection, the firmware, etc). But, I most commonly saw this occur because of TLS and the Arduino toolchain acting a little funky. If that is the case, here are two ways to resolve:

  1. Don’t use TLS. This is generally not recommended because the connection from the device to Losant won’t be secure. But if your application is nonsensitive, this could be an option.

  2. I found a lot of success and was very happy with Mongoose OS. You should give this a try. Here are some resources:



Thanks Anaptfox,
I am currently using HTTP. See my sketch below perhaps something wrong in it:


  • Example for sending temperature and humidity

  • to the cloud using the DHT22 and ESP8266