MQTT stops working on ESP8266

I’m doing some appliance automation using a WeMos D1 Mini and Cayenne MQTT. The code is totally simple, just starts Cayenne, then in the loop it updates two channels from digital readings, and reacts to updates from a third channel by a very basic sequence. Nothing fancy, and everything works nicely, I can see the updates in the dashboard, and I get the desired effect when I push the virtual button.

Well, at least until about an hour of uptime. It then simply goes offline. The device stays connected to the wifi network, I can ping it, but no more Cayenne action. I have debug enabled, and - though I couldn’t yet catch the serial output right from the time when it stops working - I can see the message logs initially, and when it doesn’t work anymore, I don’t see anything on the serial console either.

Any suggestions?

Can you post your code? Also would be good to see the debug info when you finally catch it.

Well, I’ve changed my code since then (no versioning yet), but (IMHO) not in any way which should affect this behaviour.

Anyhow, the controller did stop sending updates (or printing anything to the serial) several times after 40-120 minutes of working properly - but now it has worked well for multiple day-long spans, which were interrupted because I updated the code and reset the controller.

So, in short, unfortunately I can’t reproduce the error as of now. Which bugs me quite a bit, because this means it’s not properly solved, and is hiding somewhere to suddenly pop up again at some point.

I know the feeling. Post back if it come back!

I’m curious about what you changed in the code that could have cause this to happen. Are you able to share?