-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
baedc6e
commit d6bd168
Showing
4 changed files
with
136 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Build and Release | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- reopened | ||
- synchronize | ||
|
||
push: | ||
branches: | ||
- main | ||
|
||
release: | ||
types: [published] | ||
|
||
jobs: | ||
build: | ||
name: "Build" | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ github.head_ref }} | ||
|
||
- uses: actions/setup-python@v2 | ||
name: Install Python | ||
with: | ||
python-version: 3.9 | ||
|
||
- name: Install Poetry | ||
uses: abatilo/actions-poetry@v2.0.0 | ||
with: | ||
poetry-version: 1.1.13 | ||
|
||
- name: Install poetry-dynamic-versioning | ||
run: pip install poetry-dynamic-versioning | ||
|
||
- name: Install Dependencies | ||
run: poetry install | ||
|
||
- name: Build | ||
run: poetry build | ||
|
||
- name: Publish to PyPI | ||
if: github.event_name != 'pull_request' | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# 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 melnor_bluetooth.constants import BATTERY_UUID | ||
from melnor_bluetooth.device import Device | ||
|
||
address = '00:00:00:00:00' # fill with your device mac address | ||
|
||
async main(): | ||
device = Device(address, 4) | ||
await device.connect() | ||
|
||
print(device.battery_life); | ||
|
||
await device.disconnect(); | ||
|
||
asyncio.run(main()) | ||
|
||
``` | ||
|
||
#### Turn on a zone | ||
```python | ||
import asyncio | ||
|
||
from melnor_bluetooth.device import Device | ||
|
||
address = '00:00:00:00:00' # fill with your device mac address | ||
|
||
async main(): | ||
device = Device(address, 4) | ||
await device.connect() | ||
|
||
device.zone1.is_watering = True; | ||
|
||
await device.push_state(); | ||
await device.disconnect(); | ||
|
||
asyncio.run(main()) | ||
|
||
``` |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters