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
Metadata
Release files for mqtt-rest 0.8.1
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_rest-0.8.1.tar.gz | 15.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mqtt_rest-0.8.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 37.3 kB
Release files / mqtt_rest-0.8.1.tar.gz
| Download URL | mqtt_rest-0.8.1.tar.gz |
|---|---|
| Size | 15.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
97ef12489dbfb8579df4066a6b7eaa4bb91c9a48302c97a1db2447a48a580fbf
|
|
BLAKE2b-256 checksum How to use checksums |
7d4c4be5d3557ce0ecda3048bf51f799b2dc2ae9eeb51459a394247bbf698645
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.11.10 Linux/6.5.0-1025-azure
|
Release files / mqtt_rest-0.8.1-py3-none-any.whl
| Download URL | mqtt_rest-0.8.1-py3-none-any.whl |
|---|---|
| Size | 21.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
179dac46021594a2efd219fa7d8e9e454b1f193903671a303688cc0e20ed6ca1
|
|
BLAKE2b-256 checksum How to use checksums |
166220534b3953469f88e4c90e7e49b27514a4da57ce580ed2d664f84796979b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.11.10 Linux/6.5.0-1025-azure
|