A simple python 3 script to generate sensor data from a config file and send it to an MQTT broker.
Download mqttgen.py and config.json files (click on the Raw button at the top right and then save the content), edit config.json to fit your needs, if you are using it to run the Event Fabric sensors dashboard then don't change the topic in config.json unless you want to change it in the dashboard too.
The script uses the python paho-mqtt library you can install it with something like sudo pip3 install paho-mqtt.
python3 mqttgen.py config.json
Edit config.json, you can add as many sensors in the "sensors" object as you wish.
Change the values in "mqtt" section to match your MQTT broker settings.
- password is optional if you don't need password
- if username is missing, no authentication will be used.
Mariano Guerra from Event Fabric
Public Domain
hello can u explain me more how it works , when i run it i just got a 0 , how can i send a message or a simply data like temperature to a broker for example .