Skip to main content

A REST API for MQTT Client Management

Project description

build

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.run

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

mqtt_rest-0.5.0.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

mqtt_rest-0.5.0-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

Details for the file mqtt_rest-0.5.0.tar.gz.

File metadata

  • Download URL: mqtt_rest-0.5.0.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.9 Windows/10

File hashes

Hashes for mqtt_rest-0.5.0.tar.gz
Algorithm Hash digest
SHA256 e2a8c2e6846c8d4d597a55656b4e1f5dbd544f6a4dae37cfbeb78a2a69d120b7
MD5 05c7be9f7b5d7c60d466a3f30b8f5d25
BLAKE2b-256 24437645df2313f90c27c82c32a6639a1a8cea05df6d305a95c7aaaea7728c27

See more details on using hashes here.

File details

Details for the file mqtt_rest-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: mqtt_rest-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 16.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.9 Windows/10

File hashes

Hashes for mqtt_rest-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 182f5244b34ffbe56b64911e3e042057ff7fbb3520b562e85d01912f4158722a
MD5 269fe3b4eb76a98e7d5c0cf3570f1693
BLAKE2b-256 249718edec01ad9c20cd42b3e4613bcd7fc6d74f200dbbc51f787ed42eaa9d1e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page