-
Notifications
You must be signed in to change notification settings - Fork 721
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
Send all button press events for Sinope SW2500ZB/DM2500ZB #3438
Send all button press events for Sinope SW2500ZB/DM2500ZB #3438
Conversation
1037865
to
f9df3d8
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #3438 +/- ##
==========================================
+ Coverage 89.40% 89.41% +0.01%
==========================================
Files 309 309
Lines 10014 10027 +13
==========================================
+ Hits 8953 8966 +13
Misses 1061 1061 ☔ View full report in Codecov by Sentry. |
da1ebbc
to
14de93c
Compare
@claudegel FYI. |
bae08c9
to
35f991a
Compare
35f991a
to
5ee1785
Compare
7e5fd50
to
3cab468
Compare
I've tested my latest changes in HA and it works fine. |
3cab468
to
ec0d580
Compare
…utton events in order to properly support short and long press events. Also added the pressed button in the event arguments to simplify automations processing it.
…uments of the `zha_event`: Added "description" containing the ButtonAction name. Got rid of deprecation warnings in test_sinope.py
b15c372
to
f922d14
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thanks.
Proposed change
Added support for both press and release button events in order to properly support short and long press events.
Also added the pressed button and text description in the event arguments to simplify writing automations processing it.
ZHA now send both when we start pressing the Switch's up or down button, and when we release. Before, we were only sending events when a button was released after being pressed for a long time, or if double pressed, limiting possibilities. Now all events are sent: pressed, short released, long released and double pressed.
Note that I also added two extra arguments the the send
zha_event
because it was a bit hard to extract which button was pressed (up or down). It's now a new attribute{button: turn_on}
or{button: turn_off}
and adescription
that contains theActionButton
name (Pressed_on, Released_off, Double_on, etc.)Additional information
I have been using this as a custom quirks for a while. I have two dimmer switches DM2500ZB dimmer switches and I'm emulating a 3-way dimmers with the downstairs dimmer using an HA automation to control upstairs dimmer that has the stairs lights connect to it. It works fine.
I also have two SW2500ZB, the events are also sent as expected.
Checklist
pre-commit
checks pass / the code has been formatted using Black