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

mqtt_rest-0.8.1.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

mqtt_rest-0.8.1-py3-none-any.whl (21.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mqtt_rest-0.8.1.tar.gz
  • Upload date:
  • Size: 15.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

Hashes for mqtt_rest-0.8.1.tar.gz
Algorithm Hash digest
SHA256 97ef12489dbfb8579df4066a6b7eaa4bb91c9a48302c97a1db2447a48a580fbf
MD5 418779ba0b20f91411e046605b5eaf0b
BLAKE2b-256 7d4c4be5d3557ce0ecda3048bf51f799b2dc2ae9eeb51459a394247bbf698645

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mqtt_rest-0.8.1-py3-none-any.whl
  • Upload date:
  • Size: 21.6 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

Hashes for mqtt_rest-0.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 179dac46021594a2efd219fa7d8e9e454b1f193903671a303688cc0e20ed6ca1
MD5 3e0370d16dcce972f4b5b70f3c82ba69
BLAKE2b-256 166220534b3953469f88e4c90e7e49b27514a4da57ce580ed2d664f84796979b

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