My MQTT Python Scripts

Please rate? And use Comments to let me know more
[Total: 0    Average: 0/5]

These scripts are scripts that I’ve written while experimenting with MQTT.

You are welcome to download and use if you want to. Get them from the download Page.

Grateful any comments/problems or requests.

Script List

Simple MQTT Data Logger Class

Logs data to a text files as simple text or JSON encoded.This tutorial shows you how to use it. You Can Download the class here


 MQTT Ping – Test if broker is up.

Usage:

Type  python mqtt-ping.py -h

mqtt-ping-usage

Examples

  • 1.use -c 10 for 10 pings
  • 2. Use -d 5 for 5 second delay between pings
  • use -s to only print end result

Example Run:

MQTT-Ping-Example

MQTT- Monitor -Monitors Selected topics

Usage:

Type  python mqtt-monitor.py -h

mqtt-monitor-usage

Examples

  • Can add multiple topics by repeated use of -t option
  • Use -v no to display only changed messages
  • Use -c 100 to stop after 100 seconds
  • Use -q value (0 or 1 or 2) to set the QOS of all topics
  • Use -d yes to turn on debugging mode

mqtt-monitor-example-use

3.Mosquito Config File Comment Stripper

If you are using the default mosquitto.conf file with all of the comments then finding your settings can be a little tricky.

This script prints the settings from a config file

Usage:

mosquitto-conf-file-checker

Examples

  • -f filename – check this file

mosquitto-conf-file-checker-example

 Retained Message Scripts

retained-messsage.py

This script will list topics that have a retained message and optionally delete the retained message. Can be use from the command prompt by supplying options.

Run with the -h option to list options.

>python retained-messsage.py -h

Example

list-clear-retianed-messages

create-retained-messsage.py

This script will create retained messages from a list of topics. This is useful when testing

create-retained-message-scriptThe script can be run from command prompt but it is easier to edit, and run in the IDE or from the command prompt with no options.

edit-create-retained-message-script

Part of the MQTT-Script-tools package on downloads page

Save

Save

Save

Save

Leave a Reply

Your email address will not be published. Required fields are marked *