ESP8266 Stopped sending data to node-red

My ESP8266 doesn't send data through mqtt. It worked for about 10mins then stopped sending the data. I've tried connecting the device to a different router, and even uploading the code to a new one. But the problem persist. Is this a problem with node-red?

You could try something like MQTT Explorer to monitor MQTT traffic and help identify the source of the problem.

I'm not experienced in mqtt but how do I know determine where to start? I've downloaded mqtt explorer but i'm at a lost as to where to start.

You just need to put the same MQTT connection details into Explorer that you would have set up for the ESP8266 (ie. server, username and password). Then you can sit back and watch all of the MQTT messages being sent in real time. That way you can work out if the ESP8266 has stopped sending them, or Node Red has stopped receiving them. You can see the content of the messages too, in case you coded Node Red to do different things with different content.

I'll second the suggestion to use MQTT Explorer. It's simple to set up, and will give you a lot of useful information.

Another thing you might do, depending on how you're connecting your PC to your ESP8266, is to add some debug prints in where you're publishing the messages, so you can see if there's something going wrong there. And don't ignore return values from function calls, as they may give you an error indication (you didn't mention which MQTT library you're using, but most of them should give some useful info).

I've fixed the issue. Since PubSub library has a maximum of 128 bytes payload, it fails to send the data/or crash during sending. I've modified the library into allowing more data through payload.

2 Likes