-
Notifications
You must be signed in to change notification settings - Fork 796
Add device triggers for Legrand radiant wireless switch #3970
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
base: dev
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #3970 +/- ##
=======================================
Coverage 91.19% 91.20%
=======================================
Files 335 336 +1
Lines 10886 10891 +5
=======================================
+ Hits 9928 9933 +5
Misses 958 958 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
I think we can even use a v2 quirk for defining the device_automation_triggers
instead. This is still the old "v1 quirk style".
See this example: https://github.com/zigpy/zha-device-handlers/blob/dev/zhaquirks/sonoff/button.py
You'll likely also want to add .replaces(LegrandPowerConfigurationCluster)
though (if needed to get battery percentage working for this device).
zhaquirks/legrand/wirelessswitch.py
Outdated
LegrandPowerConfigurationCluster, | ||
Identify.cluster_id, | ||
PollControl.cluster_id, | ||
LegrandCluster, |
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.
Looking at the LegrandCluster
implementation, it seems specific to a dimmer, so we may not want to replace that here:
zha-device-handlers/zhaquirks/legrand/__init__.py
Lines 12 to 22 in a941a89
class LegrandCluster(CustomCluster): | |
"""LegrandCluster.""" | |
cluster_id = MANUFACTURER_SPECIFIC_CLUSTER_ID | |
name = "LegrandCluster" | |
ep_attribute = "legrand_cluster" | |
attributes = { | |
0x0000: ("dimmer", t.data16, True), | |
0x0001: ("led_dark", t.Bool, True), | |
0x0002: ("led_on", t.Bool, True), | |
} |
(IMO, that LegrandCluster
class should have been defined in those dimmer quirks instead and named appropriately to avoid confusion.)
( | ||
QuirkBuilder(f" {LEGRAND}", " Remote switch") | ||
.replaces(LegrandPowerConfigurationCluster) | ||
.removes(BinaryInput.cluster_id) |
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.
Proposed change
Adds on/off press and long press event support for the Legrand radiant wireless switch
Additional information
Checklist
pre-commit
checks pass / the code has been formatted using Black