The Bridging Problem (and Python)

Ok, at this point you should have data in your MQTT broker topic queue. Assuming that's true, the next step is to get the data from your local MQTT queue into Adafruit.IO. 

And here's the problem I mentioned in the introductory Overview. The data format in the local MQTT queue is sensorname value.  There's no way (that I can figure out) to translate that automatically into a pure value stream using only MQTT broker to broker bridging. Bridging is the mechanism for a topic on one broker to be sent automatically to a topic queue on another broker. It's as if the second broker has subscribed to the topic as a client. 

If I had been thinking ahead, I would have subdivided the topic queues into a tree structure, like /sensors/light01 value. If I had the foresight to do that, I could have configured a bridge from the local MQTT broker to Adafruit.IO. Alas, that's not what I did.

As a result, I had to write a Python program to read the data out of the local queue, connect to Adafruit.IO, and insert the values into the feed there. This is what the program does (from the GitHub repository).

Again, you'll need to edit the global variables at the top of the Python program to match your local configuration. Don't run it yet, though. We have to configure Adafruit.IO first.

This guide was first published on Aug 20, 2016. It was last updated on Aug 20, 2016. This page (The Bridging Problem (and Python)) was last updated on Jun 23, 2019.