[![build](https://github.com/rahulsrma26/mqtt-rest/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/rahulsrma26/mqtt-rest/actions/workflows/build.yml)
# 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
```sh
pip install mqtt-rest
```
## Running
```sh
mqtt-rest-server
```
## Docker
Dockerhub repository for [mqtt-rest](https://hub.docker.com/r/welcometors/mqtt-rest).
```sh
docker pull welcometors/mqtt-rest:latest
```
```sh
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:
```env
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
```sh
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
```sh
poetry run pytest
```
### Linting
```sh
poetry run ruff check
```
## Contributing
Install pre-commit
```sh
poetry run pre-commit install
```
Check if everything runs:
```sh
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.
```sh
poetry cache clear PyPI --all
```
Raw data
{
"_id": null,
"home_page": "https://github.com/rahulsrma26/mqtt-rest",
"name": "mqtt-rest",
"maintainer": "Rahul Sharma",
"docs_url": null,
"requires_python": "<4.0,>=3.11",
"maintainer_email": "rahulsrma26@gmail.com",
"keywords": "MQTT, REST, API",
"author": "Rahul Sharma",
"author_email": "rahulsrma26@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/7d/4c/4be5d3557ce0ecda3048bf51f799b2dc2ae9eeb51459a394247bbf698645/mqtt_rest-0.8.1.tar.gz",
"platform": null,
"description": "[![build](https://github.com/rahulsrma26/mqtt-rest/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/rahulsrma26/mqtt-rest/actions/workflows/build.yml)\n\n# MQTT-REST\n\nMQTT-REST is a project that bridges MQTT and RESTful APIs, allowing seamless communication between IoT devices using MQTT and web services using REST.\n\nIt's useful if you want to monitor arbritary stuff from a machine in Home-assistant without writing custom integration.\n\n## Installation\n\n```sh\npip install mqtt-rest\n```\n\n## Running\n\n```sh\nmqtt-rest-server\n```\n\n## Docker\n\nDockerhub repository for [mqtt-rest](https://hub.docker.com/r/welcometors/mqtt-rest).\n\n```sh\ndocker pull welcometors/mqtt-rest:latest\n```\n\n```sh\ndocker run --env-file vars.env -p 9000:9000 welcometors/mqtt-rest:latest\n```\n\nwhere `.env` file can provide a convenient way to change environment variables:\n\n```env\nBROKER_IP=<mqtt-broker-ip>\nBROKER_PORT=<mqtt-broker-port> # defaults to 1883\nMQTT_USER=<mqtt-user-name>\nMQTT_PASS=<mqtt-password>\nSERVER_LOG_LEVEL=info # uvicorn log level\nMQTT_LOG=False # enable's logging by mqtt client\n```\n\n## Development\n\n```sh\ngit clone https://github.com/rahulsrma26/mqtt-rest\ncd mqtt-rest\npoetry shell\npoetry install\npoetry run python -m mqtt_rest.run\n```\n\nIf 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`.\n\nVisit `/docs` endpoint to access API docs via SwaggerUI.\n\n### Testing\n\n```sh\npoetry run pytest\n```\n\n### Linting\n\n```sh\npoetry run ruff check\n```\n\n## Contributing\n\nInstall pre-commit\n\n```sh\npoetry run pre-commit install\n```\n\nCheck if everything runs:\n\n```sh\npoetry run pre-commit run --all-files\n```\n\nNote: The process may occasionally fail due to caching issues with PyPI. If this happens, please clear the cache before trying again.\n\n```sh\npoetry cache clear PyPI --all\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A REST API for MQTT Client Management",
"version": "0.8.1",
"project_urls": {
"Homepage": "https://github.com/rahulsrma26/mqtt-rest",
"Repository": "https://github.com/rahulsrma26/mqtt-rest"
},
"split_keywords": [
"mqtt",
" rest",
" api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "166220534b3953469f88e4c90e7e49b27514a4da57ce580ed2d664f84796979b",
"md5": "3e0370d16dcce972f4b5b70f3c82ba69",
"sha256": "179dac46021594a2efd219fa7d8e9e454b1f193903671a303688cc0e20ed6ca1"
},
"downloads": -1,
"filename": "mqtt_rest-0.8.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3e0370d16dcce972f4b5b70f3c82ba69",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.11",
"size": 21635,
"upload_time": "2024-10-31T00:26:52",
"upload_time_iso_8601": "2024-10-31T00:26:52.305769Z",
"url": "https://files.pythonhosted.org/packages/16/62/20534b3953469f88e4c90e7e49b27514a4da57ce580ed2d664f84796979b/mqtt_rest-0.8.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7d4c4be5d3557ce0ecda3048bf51f799b2dc2ae9eeb51459a394247bbf698645",
"md5": "418779ba0b20f91411e046605b5eaf0b",
"sha256": "97ef12489dbfb8579df4066a6b7eaa4bb91c9a48302c97a1db2447a48a580fbf"
},
"downloads": -1,
"filename": "mqtt_rest-0.8.1.tar.gz",
"has_sig": false,
"md5_digest": "418779ba0b20f91411e046605b5eaf0b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.11",
"size": 15629,
"upload_time": "2024-10-31T00:26:53",
"upload_time_iso_8601": "2024-10-31T00:26:53.889727Z",
"url": "https://files.pythonhosted.org/packages/7d/4c/4be5d3557ce0ecda3048bf51f799b2dc2ae9eeb51459a394247bbf698645/mqtt_rest-0.8.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-31 00:26:53",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "rahulsrma26",
"github_project": "mqtt-rest",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "mqtt-rest"
}