Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sdeancos/mqtt-client
Simple MQTT Client.
https://github.com/sdeancos/mqtt-client
automation cli client domotic home-automation internet-of-things iot m2m messaging mqtt mqtt-client paho-mqtt paho-mqtt-python python
Last synced: 3 months ago
JSON representation
Simple MQTT Client.
- Host: GitHub
- URL: https://github.com/sdeancos/mqtt-client
- Owner: sdeancos
- Created: 2018-06-08T14:42:39.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-07-12T18:45:26.000Z (over 1 year ago)
- Last Synced: 2024-06-19T03:03:15.635Z (8 months ago)
- Topics: automation, cli, client, domotic, home-automation, internet-of-things, iot, m2m, messaging, mqtt, mqtt-client, paho-mqtt, paho-mqtt-python, python
- Language: Python
- Homepage: https://mqtt.clubpulp.com/
- Size: 18.6 KB
- Stars: 17
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MQTT Client
ver: 1.6.1
[Documentation](https://mqtt.clubpulp.com/)
[![Downloads](https://pepy.tech/badge/mqtt-client)](https://pepy.tech/project/mqtt-client) [![Downloads](https://pepy.tech/badge/mqtt-client/month)](https://pepy.tech/project/mqtt-client) [![Downloads](https://pepy.tech/badge/mqtt-client/week)](https://pepy.tech/project/mqtt-client)
## Install
> pip install --upgrade mqtt-client
## Examples
```shell
mqtt-client publish --config=my_config_file.json
mqtt-client subscribe --config=my_config_file.json
``````shell
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
``````shell
mqtt-client subscribe --host=mqttbroker.testing:1883 --topic=home/room/1/up --callback=command --command=my_command
```## Usage
Simple MQTT Client.
```shell
Usage:
mqtt-client (publish | subscribe) --config=
mqtt-client publish --host= --topic= (--payload= | --interactive) [--client_id=] [--username=] [--password=] [--transport=] [--cert_path=] [--qos=] [--retain=]
mqtt-client subscribe --host= --topic= [--client_id=] [--username=] [--password=] [--transport=] [--cert_path=] [--callback=] [--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 file.
--host= Broker Host. (Example: example.your_broker.com:1883)
--topic= Topic.
--payload= Payload to send.
-i --interactive Interactive mode.
--client_id= Client ID.
--username= Username.
--password= Password.
--transport= TCP, TCP-TLS, WS, WS-TLS (Default: TCP)
--cert_path= Path cert (Default: ./mqtt_broker_cert.pem)
--qos= Qos (Default: 0)
--retain= Retain (Default: false)
--callback= Use a custom callback for subscriber. (default, raw, command)
--command= Command for callback type command.```
## Example file config
> mqtt-client publish --config=example_config.json
```json
{
"host": "mqttbroker:1883",
"topic": "my_topic",
"payload": "Testing Simple MQTT Client 1.5.0",
"interactive": false,
"client_id": "awesome-mqtt-client",
"username": "user",
"password": "pass",
"transport": "TCP",
"cert_path": "",
"qos": 0,
"retain": false,
"callback": "",
"command": ""
}
```