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.4.1.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

mqtt_rest-0.4.1-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mqtt_rest-0.4.1.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/5.15.0-91-generic

File hashes

Hashes for mqtt_rest-0.4.1.tar.gz
Algorithm Hash digest
SHA256 bc877e5a298f722cfd47b954ba806ffcf5d76a380b15c4378e2c045f82afd4a3
MD5 95ddf423ad558e56213d0aeb65fe212d
BLAKE2b-256 e9c1296d8a33ae18a561d74a6d3d5cba985a3026a251d8a49f0917f2e027ca53

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mqtt_rest-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 15.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/5.15.0-91-generic

File hashes

Hashes for mqtt_rest-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ef5cfd091e917e5e0064ff3fed5a0918ae04ceab951f36b58d8de1acd7d98e58
MD5 c697addbc967d2fcc343649d6d8f1245
BLAKE2b-256 1d0eb2f828955aae6574cfba6a843676d7d9b3376a1432ecd8fb5991a6084e57

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