melnor-bluetooth


Namemelnor-bluetooth JSON
Version 0.0.25 PyPI version JSON
download
home_page
SummaryA small python library for discovery and interacting with Melnor, Eden, etc Bluetooth water timers.
upload_time2023-06-07 12:51:13
maintainer
docs_urlNone
authorJustin Vanderhooft
requires_python>=3.9,<4.0
licenseMIT
keywords bluetooth melnor home automation irrigation gardening
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Melnor Bluetooth

![PyPI](https://img.shields.io/pypi/v/melnor-bluetooth?style=flat-square) ![Codecov branch](https://img.shields.io/codecov/c/github/vanstinator/melnor-bluetooth/main?style=flat-square) ![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/vanstinator/melnor-bluetooth/Build%20and%20Release/main?style=flat-square)
![PyPI - Downloads](https://img.shields.io/pypi/dm/melnor-bluetooth?style=flat-square)

Melnor Bluetooth is a reverse engineered implementation of the Bluetooth protocol for all "smart" bluetooth-enabled watering valves under the Melnor, EcoAquastar, Eden, and other brands.

The library _should_ run on MacOS, Linux, or Windows. It's primarily developed on MacOS and other platforms likely have bugs. PRs and tests are welcome to improve quality across all platforms.


### Getting Started

#### CLI
A simple CLI has been provided for basic debugging purposes. It's not intended for any real use and isn't suitable for running a valve in the real world.

This project uses poetry for dependency management and building. Running this project locally is as simple as the following steps:

1. Clone the repository
1. `poetry install`
1. `poetry run cli.py`


The python API has been designed to be as easy to use as possible. A few examples are provided below:

#### Read battery state
```python
import asyncio

from bleak import BleakScanner  # type: ignore - bleak has bad export types

from melnor_bluetooth.device import Device

ADDRESS = "00:00:00:00:00"  # fill with your device mac address


async def main():

    ble_device = await BleakScanner.find_device_by_address(ADDRESS)
    if ble_device is not None:
        device = Device(ble_device)
        await device.connect()
        await device.fetch_state()

        print(device.battery_level)

        await device.disconnect()


asyncio.run(main())

```

#### Turn on a zone
```python
import asyncio

from bleak import BleakScanner  # type: ignore - bleak has bad export types

from melnor_bluetooth.device import Device

address = "00:00:00:00:00"  # fill with your device mac address


async def main():
    ble_device = await BleakScanner.find_device_by_address(ADDRESS)
    if ble_device is not None:
        device = Device(ble_device)
        await device.connect()
        await device.fetch_state()

        device.zone1.is_watering = True

        await device.push_state()
        await device.disconnect()


asyncio.run(main())
```


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "melnor-bluetooth",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9,<4.0",
    "maintainer_email": "",
    "keywords": "bluetooth,melnor,home automation,irrigation,gardening",
    "author": "Justin Vanderhooft",
    "author_email": "justinvdhooft@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/82/7a/c10cf5ff3ccb2b69ed94f9a5d2008d59d29780bee2cf6cb32657edb489e2/melnor_bluetooth-0.0.25.tar.gz",
    "platform": null,
    "description": "# Melnor Bluetooth\n\n![PyPI](https://img.shields.io/pypi/v/melnor-bluetooth?style=flat-square) ![Codecov branch](https://img.shields.io/codecov/c/github/vanstinator/melnor-bluetooth/main?style=flat-square) ![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/vanstinator/melnor-bluetooth/Build%20and%20Release/main?style=flat-square)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/melnor-bluetooth?style=flat-square)\n\nMelnor Bluetooth is a reverse engineered implementation of the Bluetooth protocol for all \"smart\" bluetooth-enabled watering valves under the Melnor, EcoAquastar, Eden, and other brands.\n\nThe library _should_ run on MacOS, Linux, or Windows. It's primarily developed on MacOS and other platforms likely have bugs. PRs and tests are welcome to improve quality across all platforms.\n\n\n### Getting Started\n\n#### CLI\nA simple CLI has been provided for basic debugging purposes. It's not intended for any real use and isn't suitable for running a valve in the real world.\n\nThis project uses poetry for dependency management and building. Running this project locally is as simple as the following steps:\n\n1. Clone the repository\n1. `poetry install`\n1. `poetry run cli.py`\n\n\nThe python API has been designed to be as easy to use as possible. A few examples are provided below:\n\n#### Read battery state\n```python\nimport asyncio\n\nfrom bleak import BleakScanner  # type: ignore - bleak has bad export types\n\nfrom melnor_bluetooth.device import Device\n\nADDRESS = \"00:00:00:00:00\"  # fill with your device mac address\n\n\nasync def main():\n\n    ble_device = await BleakScanner.find_device_by_address(ADDRESS)\n    if ble_device is not None:\n        device = Device(ble_device)\n        await device.connect()\n        await device.fetch_state()\n\n        print(device.battery_level)\n\n        await device.disconnect()\n\n\nasyncio.run(main())\n\n```\n\n#### Turn on a zone\n```python\nimport asyncio\n\nfrom bleak import BleakScanner  # type: ignore - bleak has bad export types\n\nfrom melnor_bluetooth.device import Device\n\naddress = \"00:00:00:00:00\"  # fill with your device mac address\n\n\nasync def main():\n    ble_device = await BleakScanner.find_device_by_address(ADDRESS)\n    if ble_device is not None:\n        device = Device(ble_device)\n        await device.connect()\n        await device.fetch_state()\n\n        device.zone1.is_watering = True\n\n        await device.push_state()\n        await device.disconnect()\n\n\nasyncio.run(main())\n```\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A small python library for discovery and interacting with Melnor, Eden, etc Bluetooth water timers.",
    "version": "0.0.25",
    "project_urls": null,
    "split_keywords": [
        "bluetooth",
        "melnor",
        "home automation",
        "irrigation",
        "gardening"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f0d1e9285c0c5356e4cab81653f4ea831be5d5cab77203b02101cb89445f113a",
                "md5": "211b8e5a7bae9f613fb0855c36622c6b",
                "sha256": "76e42e577466b4deed32e102f75983fa7f4689f77366e65abab736846ebed468"
            },
            "downloads": -1,
            "filename": "melnor_bluetooth-0.0.25-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "211b8e5a7bae9f613fb0855c36622c6b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9,<4.0",
            "size": 13049,
            "upload_time": "2023-06-07T12:51:12",
            "upload_time_iso_8601": "2023-06-07T12:51:12.113247Z",
            "url": "https://files.pythonhosted.org/packages/f0/d1/e9285c0c5356e4cab81653f4ea831be5d5cab77203b02101cb89445f113a/melnor_bluetooth-0.0.25-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "827ac10cf5ff3ccb2b69ed94f9a5d2008d59d29780bee2cf6cb32657edb489e2",
                "md5": "d319c7c02bea574ae5575b19ce513c0f",
                "sha256": "95a54cc9779174e44e021cd88a56926523bc89a2cf3d074c890709f4748ac314"
            },
            "downloads": -1,
            "filename": "melnor_bluetooth-0.0.25.tar.gz",
            "has_sig": false,
            "md5_digest": "d319c7c02bea574ae5575b19ce513c0f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9,<4.0",
            "size": 11623,
            "upload_time": "2023-06-07T12:51:13",
            "upload_time_iso_8601": "2023-06-07T12:51:13.276661Z",
            "url": "https://files.pythonhosted.org/packages/82/7a/c10cf5ff3ccb2b69ed94f9a5d2008d59d29780bee2cf6cb32657edb489e2/melnor_bluetooth-0.0.25.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-07 12:51:13",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "melnor-bluetooth"
}
        
Elapsed time: 0.08472s