Skip to main content
100%

MQTT Generator Script

✓ Published0🌍 Public
IIoTeacher
Last edited Apr 5, 2016
Created on Sep 4, 2021

This example demonstrates a script that generates simulated sensor data and publishes it to an MQTT broker. It functions as a data source for dashboards, creating random readings within configured ranges for multiple named sensors, each with geographic coordinates, units, and descriptions. The Python 3 script uses the `paho-mqtt` library to connect and publish JSON payloads to a specified topic at a configurable interval. It reads sensor definitions and broker settings from a `config.json` file, allowing users to add or modify sensors without changing the code. The script selects a sensor at random for each message, producing a continuous stream of test data for visualization or IoT development.

AI-generated description

Similar vizzes