A REST API for MQTT Client Management
Project description
MQTT-REST
MQTT-REST is a project that bridges MQTT and RESTful APIs, allowing seamless communication between IoT devices using MQTT and web services using REST.
It's useful if you want to monitor arbritary stuff from a machine in Home-assistant without writing custom integration.
Installation
pip install mqtt-rest
Running
mqtt-rest-server
Docker
Dockerhub repository for mqtt-rest.
docker pull welcometors/mqtt-rest:latest
docker run --env-file vars.env -p 9000:9000 welcometors/mqtt-rest:latest
where .env
file can provide a convenient way to change environment variables:
BROKER_IP=<mqtt-broker-ip>
BROKER_PORT=<mqtt-broker-port> # defaults to 1883
MQTT_USER=<mqtt-user-name>
MQTT_PASS=<mqtt-password>
SERVER_LOG_LEVEL=info # uvicorn log level
MQTT_LOG=False # enable's logging by mqtt client
Development
git clone https://github.com/rahulsrma26/mqtt-rest
cd mqtt-rest
poetry shell
poetry install
poetry run python -m mqtt_rest.run
If you dont want poetry to managing virtual environment then dont need to run poetry run
or poetry shell
. In that case one can directly run python -m mqtt_rest.run
.
Visit /docs
endpoint to access API docs via SwaggerUI.
Testing
poetry run pytest
Linting
poetry run ruff check
Contributing
Install pre-commit
poetry run pre-commit install
Check if everything runs:
poetry run pre-commit run --all-files
Note: The process may occasionally fail due to caching issues with PyPI. If this happens, please clear the cache before trying again.
poetry cache clear PyPI --all
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file mqtt_rest-0.7.0.tar.gz
.
File metadata
- Download URL: mqtt_rest-0.7.0.tar.gz
- Upload date:
- Size: 14.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.11.10 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0eadd036b4e9ee5c3b0b38e81714f53f1a8eb8badc6ddd454905f71f541aa5d2 |
|
MD5 | 229813b8e1e9ac7de368222ccb14a04f |
|
BLAKE2b-256 | d49b8fd64ba138f109d7a38720a6bc545f7800c40622880e0adca71507561515 |
File details
Details for the file mqtt_rest-0.7.0-py3-none-any.whl
.
File metadata
- Download URL: mqtt_rest-0.7.0-py3-none-any.whl
- Upload date:
- Size: 20.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.11.10 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7531cc13a9620eaf34ee86f8e3433089812f44311bc1118afe02051bda91c1fe |
|
MD5 | 33534209d46b54bddbb982a1fe517f26 |
|
BLAKE2b-256 | 93a978a0dae780d253a5b92777b0500630f5a1a6a91b4ebc7c0a38313615f04f |