Skip to main content

For testing application and tools which are handling MQTT messages it’s often needed to send continuously messages on random topics to a broker. mqtt-randompub contains options to send a single message, a specific count of messages, or a constant flow of messages till the tool is terminated. Configuration files can be used to store lists of topics to create repeatable test scenarios.

Prerequisites/Installation

Use pip to make an installation.

$ pip3 install mqtt-randompub --user

There is also a Fedora package available.

$ sudo dnf -y install mqtt-randompub

For Nix or NixOS users is a package available. Keep in mind that the lastest releases might only be present in the unstable channel.

$ nix-env -iA nixos.mqtt-randompub

Get the files

Clone the mqtt-randompub repository.

git clone git@github.com:fabaff/mqtt-randompub.git

Use this option if you want to modify the code or contribute.

Dependencies

mqtt-randompub depends only on paho-mqtt . This module should be pulled in automatically when installed with pip.

On a Fedora system:

sudo dnf -y install python-paho-mqtt

Usage

To run mqtt-randompub just type:

$ mqtt-randompub -h
usage: mqtt-randompub [-h] [-c CONFIG] [-b BROKER] [-p PORT] [-q QOS]
                      [-t TOPIC] [-s SUBTOPIC1] [-d SUBTOPIC2] [-l LOAD]
                      [-i INTERVAL] [-n NUMBER]

optional arguments:
  -h, --help            show this help message and exit
  -c CONFIG, --config CONFIG
                        configuration file to use
  -b BROKER, --broker BROKER
                        set the broker
  -p PORT, --port PORT  set the proker port
  -q QOS, --qos QOS     set the QoS of the messages
  -t TOPIC, --topic TOPIC
                        set the main topic
  -s SUBTOPIC1, --subtopic1 SUBTOPIC1
                        set the first subtopic
  -d SUBTOPIC2, --subtopic2 SUBTOPIC2
                        set the second subtopic
  -l LOAD, --load LOAD  what to use as message payload
  -i INTERVAL, --interval INTERVAL
                        time in seconds between the messages
  -n NUMBER, --number NUMBER
                        number of messages to send. set to 0 for running

in a terminal to see all options. Running without any option will send a sample message to test/# to a broker which listens on localhost on port 1883.

For local testing run a MQTT broker/server on localhost.

  • mosca - A multi-transport MQTT broker for node.js (no longer maintained)

  • mosquitto - An Open Source MQTT v3.1 Broker

and subscribe to the topic test/# with a MQTT client. For example:

$ mosquitto_sub -h localhost -d -t test/#

You can run mqtt-randompub with a configuration file to re-use a previous set of topics. Check the mqtt-randompub.example file for details.

License

mqtt-randompub licensed under MIT, for more details check LICENSE.

Metadata

Release files for mqtt-randompub 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mqtt-randompub 0.5.1
File Size Uploaded
mqtt_randompub-0.5.1.tar.gz 5.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mqtt-randompub 0.5.1
File Interpreter ABI Platform
mqtt_randompub-0.5.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 12.4 kB

Release files / mqtt_randompub-0.5.1.tar.gz

Download URL mqtt_randompub-0.5.1.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
7007438a7e36150a72e1f7535463daf2dc8e8049101af229096eaaf0ce5cbd14
BLAKE2b-256 checksum
How to use checksums
edca9129ab91f19d40862c598764a1593ebf867441ed120269a78024d732c771
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 8, 2026.

Transparency log

Release files / mqtt_randompub-0.5.1-py2.py3-none-any.whl

Download URL mqtt_randompub-0.5.1-py2.py3-none-any.whl
Size 6.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
292364e285554ec77b54e6e8389a10ef6cd90e82ed16fc70fe78d45eb7843205
BLAKE2b-256 checksum
How to use checksums
343a86f63cd98ae151e18ec497f19c9d8c124e1e8756bbf3e351d5ec890ca1fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 8, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.5.1 This release

2 release files

0.4.0

2 release files

0.2.2

2 release files

0.2.1

1 release file

0.2.0

2 release files

0.1.1

1 release file

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page