Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fork lib and add hello fairy support #58

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: "3.9"
python-version: "3.10"
- uses: pre-commit/[email protected]

# Make sure commit messages follow the conventional commits convention:
Expand All @@ -36,7 +36,6 @@ jobs:
fail-fast: false
matrix:
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.11"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: 3.8
python-version: 3.10
- name: Install labels
run: pip install labels
- name: Sync config with Github
Expand Down
142 changes: 2 additions & 140 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,144 +2,6 @@

<!--next-version-placeholder-->

## v1.1.1 (2024-12-11)
## v1.0.0 (2024-12-21)

### Fix

* Refactor to use kwargs for construct_levels_change ([#53](https://github.com/Bluetooth-Devices/led-ble/issues/53)) ([`efd92ac`](https://github.com/Bluetooth-Devices/led-ble/commit/efd92aca9bcb05ac9d5ab72a19196c7717631552))

## v1.1.0 (2024-12-11)

### Feature

* Add Python 3.13 support ([#55](https://github.com/Bluetooth-Devices/led-ble/issues/55)) ([`05f3818`](https://github.com/Bluetooth-Devices/led-ble/commit/05f38188572e898af89f53a0bf1cc4f146186876))

## v1.0.2 (2024-06-24)

### Fix

* Fix license classifier ([#41](https://github.com/Bluetooth-Devices/led-ble/issues/41)) ([`b331b97`](https://github.com/Bluetooth-Devices/led-ble/commit/b331b9744caeb5fded22d8435bb8c5db7be8a362))

## v1.0.1 (2023-09-25)

### Fix

* Bump psr to fix CI ([#38](https://github.com/Bluetooth-Devices/led-ble/issues/38)) ([`ab09fed`](https://github.com/Bluetooth-Devices/led-ble/commit/ab09fedd632f937cb4064254c8e61c349f8c8d6d))
* Drop async_timeout on py3.11+ ([#37](https://github.com/Bluetooth-Devices/led-ble/issues/37)) ([`fba769f`](https://github.com/Bluetooth-Devices/led-ble/commit/fba769f33cf7ac1f89105e29615e3d15707ecdcf))
* Do not try to stop notify if read char is missing ([#36](https://github.com/Bluetooth-Devices/led-ble/issues/36)) ([`03c84f9`](https://github.com/Bluetooth-Devices/led-ble/commit/03c84f99deba04c3d04236f608e24ad137540b8c))

## v1.0.0 (2022-10-16)
### Feature
* Update for new bleak version ([#33](https://github.com/Bluetooth-Devices/led-ble/issues/33)) ([`2be176c`](https://github.com/Bluetooth-Devices/led-ble/commit/2be176cfc5492f35bc3fc019e385a3698ea572bb))

### Breaking
* The set_ble_device function has been renamed set_ble_device_and_advertisement_data and now requires the advertisement_data. ([`2be176c`](https://github.com/Bluetooth-Devices/led-ble/commit/2be176cfc5492f35bc3fc019e385a3698ea572bb))
* The constructor no longer takes a retry count since this does not need to be configurable ([`2be176c`](https://github.com/Bluetooth-Devices/led-ble/commit/2be176cfc5492f35bc3fc019e385a3698ea572bb))

## v0.10.1 (2022-09-15)
### Fix
* Handle additional bleak exceptions ([#31](https://github.com/Bluetooth-Devices/led-ble/issues/31)) ([`1ff94f7`](https://github.com/Bluetooth-Devices/led-ble/commit/1ff94f770e86d630892261178018d861d4e74a72))

## v0.10.0 (2022-09-13)
### Feature
* Update for bleak 0.17 support ([#29](https://github.com/Bluetooth-Devices/led-ble/issues/29)) ([`530de76`](https://github.com/Bluetooth-Devices/led-ble/commit/530de767892a51bb93a81830f418b168b3f13fd8))

## v0.9.1 (2022-09-11)
### Fix
* Typo in bleak-retry-connector min version pin ([#28](https://github.com/Bluetooth-Devices/led-ble/issues/28)) ([`8638ab8`](https://github.com/Bluetooth-Devices/led-ble/commit/8638ab86a73fae3a8407b4b6b3f9fe3c4193bfb0))

## v0.9.0 (2022-09-11)
### Feature
* Implement smart backoff via bleak-retry-connector ([#27](https://github.com/Bluetooth-Devices/led-ble/issues/27)) ([`a7bb1b1`](https://github.com/Bluetooth-Devices/led-ble/commit/a7bb1b1707c103010398091d5291d8827b730d7e))

## v0.8.5 (2022-09-11)
### Fix
* Bump bleak-retry-connector ([#26](https://github.com/Bluetooth-Devices/led-ble/issues/26)) ([`ac3823e`](https://github.com/Bluetooth-Devices/led-ble/commit/ac3823e546e7263e345b1deae8a7f0b94487a89e))

## v0.8.4 (2022-09-11)
### Fix
* Bump bleak-retry-connector ([#25](https://github.com/Bluetooth-Devices/led-ble/issues/25)) ([`0ad8e7b`](https://github.com/Bluetooth-Devices/led-ble/commit/0ad8e7bc240bcd9abfffb7efccef93186072c25c))

## v0.8.3 (2022-09-10)
### Fix
* Address property ([#24](https://github.com/Bluetooth-Devices/led-ble/issues/24)) ([`b85439f`](https://github.com/Bluetooth-Devices/led-ble/commit/b85439febb7fbcfb9fa7e41a7a6f6991bd25dff4))

## v0.8.2 (2022-09-10)
### Fix
* Bump bleak retry connector ([#23](https://github.com/Bluetooth-Devices/led-ble/issues/23)) ([`1fd8778`](https://github.com/Bluetooth-Devices/led-ble/commit/1fd8778e738b09122a15ec486bc83c7313545692))

## v0.8.1 (2022-09-10)
### Fix
* Bump bleak-retry-connector min version ([#22](https://github.com/Bluetooth-Devices/led-ble/issues/22)) ([`2112b18`](https://github.com/Bluetooth-Devices/led-ble/commit/2112b18c4a7afbb5ea04a6d8c5ddb2f8232816da))

## v0.8.0 (2022-09-10)
### Feature
* Export get_device from bleak-retry-connector ([#21](https://github.com/Bluetooth-Devices/led-ble/issues/21)) ([`5f41511`](https://github.com/Bluetooth-Devices/led-ble/commit/5f41511cd1684eb9277fc63896da63d50127b168))

## v0.7.1 (2022-09-06)
### Fix
* Effects on dream models ([#20](https://github.com/Bluetooth-Devices/led-ble/issues/20)) ([`b8126c1`](https://github.com/Bluetooth-Devices/led-ble/commit/b8126c1f5fe098efcc8c3d3a43a42ed5cc9136d8))

## v0.7.0 (2022-09-05)
### Feature
* Add newly discovered model 0x15 ([#17](https://github.com/Bluetooth-Devices/led-ble/issues/17)) ([`3c5f15c`](https://github.com/Bluetooth-Devices/led-ble/commit/3c5f15c80520b76fe6fa9e0933f64c3419cd3b07))

## v0.6.0 (2022-09-04)
### Feature
* Add support for more protocols ([#16](https://github.com/Bluetooth-Devices/led-ble/issues/16)) ([`c7bbb15`](https://github.com/Bluetooth-Devices/led-ble/commit/c7bbb15ec2dd291f5918850b3bdddec8cf1abae6))

## v0.5.4 (2022-08-29)
### Fix
* W channel not being cleared on rgb set ([#15](https://github.com/Bluetooth-Devices/led-ble/issues/15)) ([`048bdff`](https://github.com/Bluetooth-Devices/led-ble/commit/048bdffd52ea78ba66a1d33793db58a725bc894b))

## v0.5.3 (2022-08-29)
### Fix
* Brightness ([#14](https://github.com/Bluetooth-Devices/led-ble/issues/14)) ([`01dcf7b`](https://github.com/Bluetooth-Devices/led-ble/commit/01dcf7bd5f92a0c487924211490ba0498708100d))

## v0.5.2 (2022-08-29)
### Fix
* Missing exports ([#13](https://github.com/Bluetooth-Devices/led-ble/issues/13)) ([`911c2a0`](https://github.com/Bluetooth-Devices/led-ble/commit/911c2a0dcbdc4041247fe53a060ae4a50a85faa7))

## v0.5.1 (2022-08-29)
### Fix
* Cleanups ([#12](https://github.com/Bluetooth-Devices/led-ble/issues/12)) ([`9d3ae2a`](https://github.com/Bluetooth-Devices/led-ble/commit/9d3ae2a80bfc9d17bc9603003852b010a56a2494))

## v0.5.0 (2022-08-29)
### Feature
* Add rgbw support ([#11](https://github.com/Bluetooth-Devices/led-ble/issues/11)) ([`14ae97b`](https://github.com/Bluetooth-Devices/led-ble/commit/14ae97ba4b51fb7ebb81634028e1eac623e9a3f5))

## v0.4.2 (2022-08-29)
### Fix
* Add log ([#10](https://github.com/Bluetooth-Devices/led-ble/issues/10)) ([`d95fc61`](https://github.com/Bluetooth-Devices/led-ble/commit/d95fc61d0745002709558bc05812e8b5589ada62))

## v0.4.1 (2022-08-29)
### Fix
* Add state to log ([#9](https://github.com/Bluetooth-Devices/led-ble/issues/9)) ([`ee85bdd`](https://github.com/Bluetooth-Devices/led-ble/commit/ee85bddec3b5dac4de1aa38742662ccf97fc0fda))

## v0.4.0 (2022-08-29)
### Feature
* Add model data ([#8](https://github.com/Bluetooth-Devices/led-ble/issues/8)) ([`6df04cf`](https://github.com/Bluetooth-Devices/led-ble/commit/6df04cf9d0dfeaf6836830634df8df1a2bcbeb95))

## v0.3.0 (2022-08-29)
### Feature
* Add white channel ([#7](https://github.com/Bluetooth-Devices/led-ble/issues/7)) ([`3112249`](https://github.com/Bluetooth-Devices/led-ble/commit/31122499beb71f7af68ad5854fb58f112803c654))

## v0.2.2 (2022-08-29)
### Fix
* Remove scaling ([#6](https://github.com/Bluetooth-Devices/led-ble/issues/6)) ([`89ac78e`](https://github.com/Bluetooth-Devices/led-ble/commit/89ac78e5e41e4c5123cb8ef39505ca6bb9c5e24e))

## v0.2.1 (2022-08-29)
### Fix
* Fix disconnect ([#5](https://github.com/Bluetooth-Devices/led-ble/issues/5)) ([`44f79ee`](https://github.com/Bluetooth-Devices/led-ble/commit/44f79eea35fb027299cda5b6c3fa06da9572f258))

## v0.2.0 (2022-08-29)
### Feature
* Add example ([#4](https://github.com/Bluetooth-Devices/led-ble/issues/4)) ([`9d25f2a`](https://github.com/Bluetooth-Devices/led-ble/commit/9d25f2a2fd1043cf4679215ce16c0888f9ed6fa8))

## v0.1.0 (2022-08-29)
### Feature
* First release ([#3](https://github.com/Bluetooth-Devices/led-ble/issues/3)) ([`0875dc4`](https://github.com/Bluetooth-Devices/led-ble/commit/0875dc4ca17960cb634b66c3a3c61f9ff2c5f490))
* Build out the class ([#2](https://github.com/Bluetooth-Devices/led-ble/issues/2)) ([`f70c1a3`](https://github.com/Bluetooth-Devices/led-ble/commit/f70c1a3288dfcf749200cab167f1ee67b2ffcd3e))

### Fix
* Ci ([#1](https://github.com/Bluetooth-Devices/led-ble/issues/1)) ([`dba3484`](https://github.com/Bluetooth-Devices/led-ble/commit/dba3484f8aabb76db51365179cfecfb1caeed528))
* Initial release.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,4 @@ $ pytest tests

The deployment should be automated and can be triggered from the Semantic Release workflow in GitHub. The next version will be based on [the commit logs](https://python-semantic-release.readthedocs.io/en/latest/commit-log-parsing.html#commit-log-parsing). This is done by [python-semantic-release](https://python-semantic-release.readthedocs.io/en/latest/index.html) via a GitHub action.

[gh-issues]: https://github.com/bluetooth-devices/led-ble/issues
[gh-issues]: https://github.com/jr4/led-ble/issues
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# LED BLE

<p align="center">
<a href="https://github.com/bluetooth-devices/led-ble/actions?query=workflow%3ACI">
<img src="https://img.shields.io/github/workflow/status/bluetooth-devices/led-ble/CI/main?label=CI&logo=github&style=flat-square" alt="CI Status" >
<a href="https://github.com/jr4/led-ble/actions?query=workflow%3ACI">
<img src="https://img.shields.io/github/workflow/status/jr4/led-ble/CI/main?label=CI&logo=github&style=flat-square" alt="CI Status" >
</a>
<a href="https://led-ble.readthedocs.io">
<img src="https://img.shields.io/readthedocs/led-ble.svg?logo=read-the-docs&logoColor=fff&style=flat-square" alt="Documentation Status">
</a>
<a href="https://codecov.io/gh/bluetooth-devices/led-ble">
<img src="https://img.shields.io/codecov/c/github/bluetooth-devices/led-ble.svg?logo=codecov&logoColor=fff&style=flat-square" alt="Test coverage percentage">
<a href="https://codecov.io/gh/jr4/led-ble">
<img src="https://img.shields.io/codecov/c/github/jr4/led-ble.svg?logo=codecov&logoColor=fff&style=flat-square" alt="Test coverage percentage">
</a>
</p>
<p align="center">
Expand All @@ -30,13 +30,17 @@
<img src="https://img.shields.io/pypi/l/led-ble.svg?style=flat-square" alt="License">
</p>

Control a wide range of LED BLE devices
Control a wide range of LED BLE devices.

This is a fork of the excellent [led-ble](https://github.com/Bluetooth-Devices/led-ble). This fork contains support
for devices that can be controlled by the Hello Fairy app. (It does not drop support for the original library's devices, but
is not tested on them as this author does not own any.)

## Installation

Install this via pip (or your favourite package manager):

`pip install led-ble`
`pip install led-ble-hf`

## Contributors ✨

Expand Down
2 changes: 1 addition & 1 deletion docs/source/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
The package is published on [PyPI](https://pypi.org/project/deezer-python/) and can be installed with `pip` (or any equivalent):

```bash
pip install led-ble
pip install led-ble-hf
```
2 changes: 1 addition & 1 deletion docs/source/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
To use this package, import it:

```python
import led_ble
import led_ble_hf
```

TODO: Document usage
23 changes: 19 additions & 4 deletions examples/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
from bleak.backends.device import BLEDevice
from bleak.backends.scanner import AdvertisementData

from led_ble import LEDBLE, LEDBLEState
from led_ble_hf import LEDBLE, LEDBLEState

_LOGGER = logging.getLogger(__name__)

ADDRESS = "D0291B39-3A1B-7FF2-787B-4E743FED5B25"
ADDRESS = "D0291B39-3A1B-7FF2-787B-4E743FED5B25"
ADDRESS = "BE:27:E1:00:10:63" # Hello Fairy-1063PPPP


async def run() -> None:
Expand All @@ -34,22 +33,38 @@ def on_state_changed(state: LEDBLEState) -> None:
device = await future
led = LEDBLE(device)
cancel_callback = led.register_callback(on_state_changed)
_LOGGER.info("update...")
await led.update()
_LOGGER.info("turn_on...")
await led.turn_on()
_LOGGER.info("set_rgb(red)...")
await led.set_rgb((255, 0, 0), 255)
await asyncio.sleep(1)
_LOGGER.info("set_rgb(green)...")
await led.set_rgb((0, 255, 0), 128)
await asyncio.sleep(1)
_LOGGER.info("set_rgb(blue)...")
await led.set_rgb((0, 0, 255), 255)
await asyncio.sleep(1)
_LOGGER.info("set_rgbw(white)...")
await led.set_rgbw((255, 255, 255, 128), 255)
await asyncio.sleep(1)
_LOGGER.info("set_preset_pattern(1)...")
await led.async_set_preset_pattern(1, 100, 100)
await asyncio.sleep(2)
_LOGGER.info("set_preset_pattern(59)...")
await led.async_set_preset_pattern(59, 100, 100)
await asyncio.sleep(2)
_LOGGER.info("turn_off...")
await led.turn_off()
_LOGGER.info("update...")
await led.update()
_LOGGER.info("finish...")
cancel_callback()
await scanner.stop()
_LOGGER.info("done")


logging.basicConfig(level=logging.INFO)
logging.getLogger("led_ble").setLevel(logging.DEBUG)
logging.getLogger("led_ble_hf").setLevel(logging.DEBUG)
asyncio.run(run())
Loading
Loading