Simple Python MQTT Topic Logger

The MQTT data logger logs data to all monitored topics to the same log files. If the data need to be split into topics then it will need to be done by the log analyser software.

Continue reading

Checking Active MQTT Client Connections

This tutorial is in response to a question I received on the client connections tutorial page: I’ve been struggling to find a real client connection status tool, dashboard or anything which will show a list of my clients and their connection status. Clearly the broker via the low-level protocol mechanics maintain an MQTT keepalive table for each client — that’s how Last Will and Testament (LWT) is triggered internally by the broker. However how does one display such table? The problem is that you have no way of accessing the connections table on the broker so the only way is to

Continue reading

How to Send JSON Data Over MQTT with Python

Encoding data in JSON is popular for sending data over the Internet and also for storing data. You can encode a Python List or dictionary in JSON format and then decode it back into a list or dictionary as illustrated in the diagram below:

Continue reading

Simple Python MQTT Data Logger

Most MQTT brokers don’t provide any mechanism for logging historical data for later analysis. However due to the publish/subscribe nature of MQTT is is easy to monitor, and log a data stream or streams using an MQTT client.

Continue reading

Simple Controllable MQTT Sensor Simulator in Python

The aim of this project is to create a very simple two state sensor, that can be controlled externally using MQTT. The sensor could be used to simulate real world objects like lights, doors etc that have two states on or off, open or closed etc in IOT projects.

Continue reading