mqtt_decorator
mqtt_decorator is a decorator module which converts mqtt subscriptions and messages to a Flask like api.
Installing
The package can be installed via pip
pip install mqtt_decorator
Demo
from mqtt_decorator import MqttDecorator
import paho.mqtt.client as mqtt
# you can specify all
# paho mqtt client options
# such as websocket connections or
# tls connections
mqttc = mqtt.Client(clean_session=True)
app = MqttDecorator(mqttc)
@app.route("$SYS/<broker>/<type>")
def broker_url_params(msg, broker, type):
print("---broker_url_params", msg.topic, msg.payload)
print("--broker", broker)
print("--type", type)
@app.route("$SYS/broker/version")
def version(msg):
print("---version", msg.topic, msg.payload)
@app.route("$SYS/broker/uptime")
def uptime(msg):
print("---uptime", msg.topic, msg.payload)
if __name__ == "__main__":
app.run( "mqtt.eclipse.org", 1883 )
Development
In this repo issue based development is active. For any problems or new enhancements please open a issue.
Create virtual environment (It should be done only for first installation)
conda create -n mqtt_decorator python=3.8
Activate virtual environment
conda activate mqtt_decorator
Install this package
pip install -e .
Autopep8 is used for formatting.
autopep8 -r -i mqtt_decorator test
Pylint is used for linting.
pylint mqtt_decorator
Docs
for the first time
sphinx-apidoc -F mqtt_decorator -o docs/source
just update the auto docs
sphinx-apidoc -f mqtt_decorator -o docs/source
Deployment
The following 2 commands are required to deploy over pypi.
python setup.py sdist bdist_wheel
twine upload --repository-url https://upload.pypi.org/legacy/ dist/*
Licence
GPL
Acknowledges
This package is developed using
- Python <3
- Paho-Mqtt Heavily inspired from
- Flask
Contributors
Metadata
Release files for mqtt-decorator 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mqtt_decorator-0.1.4.tar.gz | 22.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mqtt_decorator-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 39.8 kB
Release files / mqtt_decorator-0.1.4.tar.gz
| Download URL | mqtt_decorator-0.1.4.tar.gz |
|---|---|
| Size | 22.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ee6384fc09d3bd08e1b8caab99aabc44f20bba5f0ce42f0baa6617c0f2d995f6
|
|
BLAKE2b-256 checksum How to use checksums |
f4d8e097b4a5e4e40bae13f4aee059715e5e2abe0a73068f1539848cd7165d94
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12
|
Release files / mqtt_decorator-0.1.4-py3-none-any.whl
| Download URL | mqtt_decorator-0.1.4-py3-none-any.whl |
|---|---|
| Size | 17.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4184f3f8831092fa01860040ca805b88d4e1e3e4a3bb5118afcce1d17a36e73b
|
|
BLAKE2b-256 checksum How to use checksums |
3c4e2154fff5f7236e6eb3f380b0a0aacc9018db620e9c5c45c72b743feb9c1f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12
|