Bluetooth-Devices / bthome-ble

Parser for BTHome BLE devices
https://bthome.io/
MIT License
69 stars 14 forks source link

Button and dimmer events #18

Closed Ernst79 closed 1 year ago

Ernst79 commented 1 year ago

As proposed in https://github.com/home-assistant/bthome.io/issues/5#issuecomment-1285504858 this PR removes the switch events and changes the evens for buttons and dimmers.

Button --> events (press, single press, double press, triple press, long press, double long press, triple long press) Dimmer --> events (rotate right x steps, rotate left x steps)

Also added the option to broadcast "no event", which you will need in case you have a triple button device, and only want to send an event with e.g. the 2nd and 3rd button. As the order of button 1, 2 an 3 has to be the same in each message, it will be required to send "no event (None)" for the first button.

codecov[bot] commented 1 year ago

Codecov Report

Base: 73.65% // Head: 74.94% // Increases project coverage by +1.28% :tada:

Coverage data is based on head (b796cdb) compared to base (2f43a29). Patch coverage: 87.50% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## V2 #18 +/- ## ========================================== + Coverage 73.65% 74.94% +1.28% ========================================== Files 6 6 Lines 429 443 +14 Branches 61 65 +4 ========================================== + Hits 316 332 +16 + Misses 91 90 -1 + Partials 22 21 -1 ``` | [Impacted Files](https://codecov.io/gh/Bluetooth-Devices/bthome-ble/pull/18?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | Coverage Δ | | |---|---|---| | [src/bthome\_ble/bthome\_v2\_encryption.py](https://codecov.io/gh/Bluetooth-Devices/bthome-ble/pull/18/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-c3JjL2J0aG9tZV9ibGUvYnRob21lX3YyX2VuY3J5cHRpb24ucHk=) | `61.33% <0.00%> (ø)` | | | [src/bthome\_ble/const.py](https://codecov.io/gh/Bluetooth-Devices/bthome-ble/pull/18/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-c3JjL2J0aG9tZV9ibGUvY29uc3QucHk=) | `100.00% <ø> (ø)` | | | [src/bthome\_ble/parser.py](https://codecov.io/gh/Bluetooth-Devices/bthome-ble/pull/18/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-c3JjL2J0aG9tZV9ibGUvcGFyc2VyLnB5) | `80.07% <90.00%> (+1.69%)` | :arrow_up: | | [src/bthome\_ble/event.py](https://codecov.io/gh/Bluetooth-Devices/bthome-ble/pull/18/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-c3JjL2J0aG9tZV9ibGUvZXZlbnQucHk=) | `100.00% <100.00%> (ø)` | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.