# aiomysensors
<p align="center">
<a href="https://github.com/MartinHjelmare/aiomysensors/actions/workflows/ci.yml?query=branch%3Amain">
<img src="https://img.shields.io/github/actions/workflow/status/MartinHjelmare/aiomysensors/ci.yml?branch=main&label=CI&logo=github&style=flat-square" alt="CI Status" >
</a>
<a href="https://codecov.io/gh/MartinHjelmare/aiomysensors">
<img src="https://img.shields.io/codecov/c/github/MartinHjelmare/aiomysensors.svg?logo=codecov&logoColor=fff&style=flat-square" alt="Test coverage percentage">
</a>
</p>
<p align="center">
<a href="https://python-poetry.org/">
<img src="https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json" alt="Poetry">
</a>
<a href="https://github.com/astral-sh/ruff">
<img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Ruff">
</a>
<a href="https://github.com/pre-commit/pre-commit">
<img src="https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white&style=flat-square" alt="pre-commit">
</a>
</p>
<p align="center">
<a href="https://pypi.org/project/aiomysensors/">
<img src="https://img.shields.io/pypi/v/aiomysensors.svg?logo=python&logoColor=fff&style=flat-square" alt="PyPI Version">
</a>
<img src="https://img.shields.io/pypi/pyversions/aiomysensors.svg?style=flat-square&logo=python&logoColor=fff" alt="Supported Python versions">
<img src="https://img.shields.io/pypi/l/aiomysensors.svg?style=flat-square" alt="License">
</p>
---
**Source Code**: <a href="https://github.com/MartinHjelmare/aiomysensors" target="_blank">https://github.com/MartinHjelmare/aiomysensors </a>
---
Python asyncio package to connect to MySensors gateways.
## Installation
Install this via pip (or your favourite package manager):
`pip install aiomysensors`
## Example
```py
"""Show a minimal example using aiomysensors."""
import asyncio
from aiomysensors import AIOMySensorsError, Gateway, SerialTransport
async def run_gateway() -> None:
"""Run a serial gateway."""
port = "/dev/ttyACM0"
baud = 115200
transport = SerialTransport(port, baud)
try:
async with Gateway(transport) as gateway:
async for message in gateway.listen():
print("Message received:", message)
except AIOMySensorsError as err:
print("Error:", err)
if __name__ == "__main__":
try:
asyncio.run(run_gateway())
except KeyboardInterrupt:
pass
```
## Command Line Interface
There's a CLI for testing purposes.
```sh
aiomysensors --debug serial-gateway -p /dev/ttyACM0
```
## Credits
This package was created with
[Copier](https://copier.readthedocs.io/) and the
[browniebroke/pypackage-template](https://github.com/browniebroke/pypackage-template)
project template.
Raw data
{
"_id": null,
"home_page": "https://github.com/MartinHjelmare/aiomysensors",
"name": "aiomysensors",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.12",
"maintainer_email": null,
"keywords": null,
"author": "Martin Hjelmare",
"author_email": "marhje52@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/1e/aa/a6d6246360e80b3852287de8ccce947d662ae46bb86494799a565991b0c7/aiomysensors-0.4.13.tar.gz",
"platform": null,
"description": "# aiomysensors\n\n<p align=\"center\">\n <a href=\"https://github.com/MartinHjelmare/aiomysensors/actions/workflows/ci.yml?query=branch%3Amain\">\n <img src=\"https://img.shields.io/github/actions/workflow/status/MartinHjelmare/aiomysensors/ci.yml?branch=main&label=CI&logo=github&style=flat-square\" alt=\"CI Status\" >\n </a>\n <a href=\"https://codecov.io/gh/MartinHjelmare/aiomysensors\">\n <img src=\"https://img.shields.io/codecov/c/github/MartinHjelmare/aiomysensors.svg?logo=codecov&logoColor=fff&style=flat-square\" alt=\"Test coverage percentage\">\n </a>\n</p>\n<p align=\"center\">\n <a href=\"https://python-poetry.org/\">\n <img src=\"https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json\" alt=\"Poetry\">\n </a>\n <a href=\"https://github.com/astral-sh/ruff\">\n <img src=\"https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json\" alt=\"Ruff\">\n </a>\n <a href=\"https://github.com/pre-commit/pre-commit\">\n <img src=\"https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white&style=flat-square\" alt=\"pre-commit\">\n </a>\n</p>\n<p align=\"center\">\n <a href=\"https://pypi.org/project/aiomysensors/\">\n <img src=\"https://img.shields.io/pypi/v/aiomysensors.svg?logo=python&logoColor=fff&style=flat-square\" alt=\"PyPI Version\">\n </a>\n <img src=\"https://img.shields.io/pypi/pyversions/aiomysensors.svg?style=flat-square&logo=python&logoColor=fff\" alt=\"Supported Python versions\">\n <img src=\"https://img.shields.io/pypi/l/aiomysensors.svg?style=flat-square\" alt=\"License\">\n</p>\n\n---\n\n**Source Code**: <a href=\"https://github.com/MartinHjelmare/aiomysensors\" target=\"_blank\">https://github.com/MartinHjelmare/aiomysensors </a>\n\n---\n\nPython asyncio package to connect to MySensors gateways.\n\n## Installation\n\nInstall this via pip (or your favourite package manager):\n\n`pip install aiomysensors`\n\n## Example\n\n```py\n\"\"\"Show a minimal example using aiomysensors.\"\"\"\nimport asyncio\n\nfrom aiomysensors import AIOMySensorsError, Gateway, SerialTransport\n\n\nasync def run_gateway() -> None:\n \"\"\"Run a serial gateway.\"\"\"\n port = \"/dev/ttyACM0\"\n baud = 115200\n transport = SerialTransport(port, baud)\n\n try:\n async with Gateway(transport) as gateway:\n async for message in gateway.listen():\n print(\"Message received:\", message)\n except AIOMySensorsError as err:\n print(\"Error:\", err)\n\n\nif __name__ == \"__main__\":\n try:\n asyncio.run(run_gateway())\n except KeyboardInterrupt:\n pass\n```\n\n## Command Line Interface\n\nThere's a CLI for testing purposes.\n\n```sh\naiomysensors --debug serial-gateway -p /dev/ttyACM0\n```\n\n## Credits\n\nThis package was created with\n[Copier](https://copier.readthedocs.io/) and the\n[browniebroke/pypackage-template](https://github.com/browniebroke/pypackage-template)\nproject template.\n\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Python asyncio package to connect to MySensors gateways.",
"version": "0.4.13",
"project_urls": {
"Bug Tracker": "https://github.com/MartinHjelmare/aiomysensors/issues",
"Changelog": "https://github.com/MartinHjelmare/aiomysensors/blob/main/CHANGELOG.md",
"Homepage": "https://github.com/MartinHjelmare/aiomysensors",
"Repository": "https://github.com/MartinHjelmare/aiomysensors"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "85c88c9475b460c015dd5d78e835fe9f80caa3a38fd003436edf823334279a32",
"md5": "0e0bf1124790e5f387eabe67b05777e0",
"sha256": "319eacf1a159a6c25ceefd4e9b6c4240e71b0706e4744fed41c12c64ff153552"
},
"downloads": -1,
"filename": "aiomysensors-0.4.13-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0e0bf1124790e5f387eabe67b05777e0",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.12",
"size": 39355,
"upload_time": "2024-12-19T06:25:14",
"upload_time_iso_8601": "2024-12-19T06:25:14.968367Z",
"url": "https://files.pythonhosted.org/packages/85/c8/8c9475b460c015dd5d78e835fe9f80caa3a38fd003436edf823334279a32/aiomysensors-0.4.13-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1eaaa6d6246360e80b3852287de8ccce947d662ae46bb86494799a565991b0c7",
"md5": "3ffbe96188de9a13e67b2bd80039e214",
"sha256": "eaa4608a7da8cae6de4fc39c4420a2d9cd3e385c2fe9084901c73049d1612b43"
},
"downloads": -1,
"filename": "aiomysensors-0.4.13.tar.gz",
"has_sig": false,
"md5_digest": "3ffbe96188de9a13e67b2bd80039e214",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.12",
"size": 25853,
"upload_time": "2024-12-19T06:25:18",
"upload_time_iso_8601": "2024-12-19T06:25:18.800224Z",
"url": "https://files.pythonhosted.org/packages/1e/aa/a6d6246360e80b3852287de8ccce947d662ae46bb86494799a565991b0c7/aiomysensors-0.4.13.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-19 06:25:18",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "MartinHjelmare",
"github_project": "aiomysensors",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "aiomysensors"
}