ESP8266 and MQTT

ESP8266 and MQTT, Google that and see what happens (you most likely already did and that is how you got here). Shit is everywhere. It’s gobbin up the bandwidth of the intarwebs. And you know what? I couldn’t get any of that shit to work on my standard ESP8266-01. I have a few of them, I tried them all with all kinds of shit. I would get close but never a damn cigar (I can’t smoke it anyways). Until today for months I have been stuck on this. So if you are like me and have not been able to get the damn thing to work, for whatever reason, try this. Hope it helps.

This is the page that saved it all for me, thank these guys (I did not read or follow any guidelines on this page, I merely snagged their code):
https://developer.ibm.com/recipes/tutorials/connect-espressif-esp8266-to-ibm-iot-foundation/

I copied “mainIoTF.lua” and made some minor tweaks to get it working. I removed the orgID and changed the broker to my raspi IP address. Don’t forget to change the topic. I made those tweaks and uploaded it. BAM!! I was getting data send via MQTT to the Pi every 10 seconds.

This is what I was getting on Node-Reds debug window every 10 seconds (the number will change):  {"d": {"data":69}}

This is where it comes from, should be easy enough to modify:
m:publish(topic ,'{"d": {"data":'..t1..'}}', 0, 0,

I came back and edited this post because I hate it when I find a site that says they found the fix, but never posts it.. so heres the code. Like I said, its 99% the same code from the other site I linked/mentioned. But here it is for you anyways.


Discover more from Its_All.Lost

Subscribe to get the latest posts sent to your email.

2 Comments

Leave a Reply