More MQTT Updates

I have revisited the MQTT Publisher and Subscriber again. I have created 3 different “types” or “ways” to send data through MQTT Publisher. The 3 types are as follows

  1. Kootnet Sensor Format – Send a dictionary of all selected and available readings. Each index of the dictionary is specific to Kootnet Sensors database column names and used when writing data to the MQTT Subscriber SQLite database.
  2. Topic Per Sensor – This sends each sensor reading to a specific topic, including readings with multiple variables, such as the accelerometer. So there is a separate topic for accelerometer X, Y and Z for example.
  3. Custom Single String – A text string is provided by the user, of which, specially formated text inside it is replaced with actual sensor values, then sent to the base MQTT topic.

Type 1 and 2 are fairly straight forward, but type 3 deserves a bit more explination. Here is an example of a custom string.

{“DeviceID”: {{ SystemHostName }}, “Temperature”: {{ EnvTemp }}, “Humidity”: {{ Humidity }}}

In this example, a JSON (or Python dictionary) string is sent. However, all text with {{ Something }} is replaced with actual values. So if this was to be sent, it might look like this to the MQTT broker.

{“DeviceID”: MySensorName, “Temperature”: 45.23, “Humidity”: 22.5}

There will be a link above the MQTT Custom string text area to give a list of all the available text that gets replaced by sensor data. Using the MQTT Publisher custom string should allow Kootnet Sensors to work with almost all MQTT brokers being used for sensor readings collection. The MQTT Subscriber has also been updated to work with the new Publisher send types.

I also did some other misc. updates and fixes to things like Plotly graphing and the GUI test program. I need to work on updating the documentation, doing some more tests then I’ll release it to the Stable channel. After that, I kinda want to do some courses on web design, specifically HTML, CSS and javascript. I’m hoping to not only make the web interface look better, but I also want to cut down on the required 3rd party scripts to improve load time and data transmission. It’s also fairly messy… so cleaning it up would be a bounus.

This new version is in the Dev channel and seems stable, so it should be safe to try out, just be warned, the MQTT Publisher configuration gets reset on this upgrade.

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>