Home

Awesome

MQTT Recorder

Simple cli tool for recording and replaying MQTT messages.

Install

pip install mqtt-recorder

Usage

ArgumentDescriptionRequiredDefault
-h, --helpShow help
--hostMQTT broker addressx
--portMQTT broker port1883
--client_idMQTT Client ID
--modemode: record/replayx
--fileoutput/input csv filex
--looplooping replayfalse
--qosQuality of Service that will be used for subscriptions0
--topicsjson file containing selected topics for subscriptionsnull
-t, --topicSingle topic to subscribe tonull
--enable_sslTrue to enable MQTTs support, False otherwiseFalse
--tls_insecureIf certs is self-generated, change to TrueFalse
--ca_certPath to the Certificate Authority certificate filesNone
--certfilePath to the client certificateNone
--keyfilePath to the client private keyNone
--usernameMQTT broker usernameNone
--passwordMQTT broker passwordNone
--encode_b64True to store message payloads as base64 encoded stringsFalse
--csv_field_size_limitCSV field size limitFalse

Recording

Subscribing to every topic

mqtt-recorder --host localhost --mode record --file recording.csv

Subscribing to selected topics

mqtt-recorder --host localhost --mode record --file test.csv --topics topics.json<br> Topics can be selected using a json file. Example

{
    "topics": [
        "/myhome/groundfloor/livingroom/temperature",
        "USA/California/San Francisco/Silicon Valley"
    ]
}

Replaying

mqtt-recorder --host localhost --mode replay --file test.csv