Sunday, July 16, 2017

Updating ESP8266 MQTT code

While working on my flow and pressure project, I stumbled upon a notice that Adafruit planned to change the SSL info for I had been using this (beta) site for mqtt telemetry. And so today... sure enough: my code is broken & no longer connecting.

I was hoping it was a simple matter of updating the SSL fingerprint to a new value.

const char* fingerprint = "26 96 1C 2A 51 07 FD 15 80 96 93 AE F7 32 CE B9 0D 01 55 C4";
No luck there, as the fingerprint did not change - but the declarative name did. <sigh> Well, so the github repository is here. But I have been blissfully ignorant of exactly where everything is stored. A mixed blessing in allowing me focusing on my code, but sometimes scary in not knowing how everything works. Alas no-one can know everything. So back to the ESP8266 crutch: The Arduino IDE! Click Sketch - Include Library - Manage Libraries. (it is the top-most menu item). Find the installed adafruit mqtt library and click update!

If like me - you are using VisualMicro, I believe it is usually best to exit and restart Visual Studio.

It didn't work. Not only does the connection still fail, but the needed code was apparently not actually updated (the drawback of hiding libraries in a GUI). I know it is not working as the new fingerprint is defined with AIO_SSL_FINGERPRINT and the old one with fingerprint, and there's no compile error without the AIO_SSL_FINGERPRINT. So ya, there appears to be a new include file: adafruitio_definition. I have no such file on my entire system. Well, seems that the Arduino IDE was not successful in getting the really latest adafruit mqtt library.
So the issue here is more than the MQTT library... I also needed to update the Adafruit Arduino IO (listed immediately above in the screen snip). Again exit / restart Visual Studio.

Next, I saw this error:
AdafruitIO.h: 22:31: fatal error: ArduinoHttpClient.h: No such file or directory
   #include "ArduinoHttpClient.h"
   compilation terminated
Seems that the latest Adafruit MQTT also needs the new (apparently experimental at this time) ArduinoHttpClient library. So I installed that from Arduino IDE as well. And restarted Visual Studio. So ya, just as described here. (once you kow that the Arduino IO library is required by new new MQTT.

Ok, so now what? The github repository sample code for adafruitio secure esp8266 is still from last year. No tweets from adafruitio. No other messages on the forum. Blog apparently has "major outage".

End of story for today on this topic. Hopefully more documentation and examples will be available soon.

No comments:

Post a Comment

comments are welcome, but I prefer not to allow links to promotions or other unrelated services.

OpenWrt Remote Network WireShark Packet Feed

After my last post on installing OpenWrt on a Cisco/LinkSys EA3500 to stream RTL-SDR data , I was inspired to investigate other "intere...