MQTT-CLIENT

v1.6.1

Downloads Downloads Downloads

Simple MQTT Subscribe and Publish Client for shell.

You can learn more about the MQTT protocol on its official page: mqtt.org

Last release on Jul 12, 2023 - v1.6.1 -

I would like to tell you that if you are using this software and find it useful enough, I would love to hear about it. You can write to me at samuel@deancos.com


Install

pip install --upgrade mqtt-client

Or download releases: Github

Please any problem you can feel free to open a ticket within the possibilities of time I will try to work on it.

GITHUB ISSUES PAGE


Usage

    Usage:
      mqtt-client (publish | subscribe) --config=<config>
      mqtt-client publish --host=<host> --topic=<topic> (--payload=<payload> | --interactive) [--client_id=<client_id>] [--username=<username>] [--password=<password>] [--transport=<transport>] [--cert_path=<cert_path>] [--qos=<qos>] [--retain=<retain>]
      mqtt-client subscribe --host=<host> --topic=<topic> [--client_id=<client_id>] [--username=<username>] [--password=<password>] [--transport=<transport>] [--cert_path=<cert_path>] [--callback=<callback>] [--command=<command>]
      mqtt-client (-h|--help)
      mqtt-client (-v|--version)

    Commands:
      publish                   Publish to topic from MQTT Broker.
      subscribe                 Subscribe to topic from MQTT Broker.

    Options:
      -h --help                 Show this screen.
      -v --version              Show version.
      --config=<config>           Config file.
      --host=<host>             Broker Host. (Example: mqtt.myMosquitto.org:1883)
      --topic=<topic>           Topic.
      --payload=<payload>       Payload to send.
      -i --interactive          Interactive mode.
      --client_id=<client_id>   Client ID.
      --username=<username>     Username.
      --password=<password>     Password.
      --transport=<transport>   TCP, TCP-TLS, WS, WS-TLS (Default: TCP)
      --cert_path=<cert_path>   Path cert (Default: ./mqtt_broker_cert.pem)
      --qos=<qos>               Qos (Default: 0)
      --retain=<retain>         Retain (Default: false)
      --callback=<callback>     Use a custom callback for subscriber. (default, raw, command)
      --command=<command>       Command for callback type command.

        

Examples

        mqtt-client publish --config=my_config_file.json
        mqtt-client subscribe --config=my_config_file.json

        mqtt-client publish --host=mqttbroker.testing:1883 --topic=home/room/1/up --payload=ok
        mqtt-client publish --host=mqttbroker.testing:1883 --topic=home/room/1/up --interactive
        mqtt-client subscribe --host=mqttbroker.testing:1883 --topic=home/room/1/up

        mqtt-client subscribe --host=mqttbroker.testing:1883 --topic=home/room/1/up --callback=command --command=my_command
        

File config example (json)

    {
        "host": "test.mosquitto.org:1883",
        "topic": "my_topic/example",
        "payload": "Testing Simple MQTT Client 1.6.1",
        "interactive": false,
        "client_id": "Awesome MQTT Client",
        "username": "user123",
        "password": "pass1.2word",
        "transport": "TCP",
        "cert_path": "",
        "qos": 1,
        "retain": false,
        "callback": "",
        "command": ""
    }
        

- Samuel de Ancos (2018-2019-2020-2021-2022-2023) -

All trademarks mentioned are the property of their respective owners.

[ HTML - CSS - spectre.css ]