Part of automation involves using the niffty little esp gadgets. So many programming examples to be had and many already written for use. I find these things to be perfect for hacking together relay controls, temperature and humidity sensors, and general equipment control.
Needless to say, I am also somewhat disorganized and seem to loose many of the custom .ino code I have written. But then again, who cares when you can just cut and past from some examples online! And there is the rub…
This week I have been updating code and replacing/combining some of the sensors and controllers. Having once again lost my original code, I quickly took an example from online and used it to make my MQTT broker connections. No issues. The first unit was up and running in no time!
Having experienced success, I deployed another similarly coded project only to find the original one was behaving badly. Having quite a bit of experience with TCP/IP, applications, and all that fun stuff I quickly began to troubleshoot the issue. Can you guess?

After watching the MQ disconnect and reconnect constantly with no seemingly good reason, I finally noticed… “ESPClient”. In my rush to production, neglected to choose an appropriate name for each instance! So now the two devices were fighting to maintain the same MQTT connection name. Duh! Correcting that – all good!


