-
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
Add Linxura smart controller button quirk #3392
Conversation
Linxura smart controller's Zigbee mode support four buttons. Each button support click, double click, long press actions.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #3392 +/- ##
==========================================
+ Coverage 88.49% 89.67% +1.17%
==========================================
Files 305 316 +11
Lines 9621 10281 +660
==========================================
+ Hits 8514 9219 +705
+ Misses 1107 1062 -45 ☔ View full report in Codecov by Sentry. |
modify spell issue
Remove the constant STATUS_REPORT and replace it with getting the id of zone_status.
Co-authored-by: TheJulianJES <[email protected]>
All suggested modifications has been made. Please review if you spare time. Many thanks! |
tests/test_linxura.py
Outdated
@pytest.mark.parametrize("quirk", (zhaquirks.linxura.button.LinxuraButton,)) | ||
async def test_edge_case_request(zigpy_device_from_quirk, quirk): | ||
"""Test edge case.""" | ||
|
||
device = zigpy_device_from_quirk(quirk) | ||
|
||
# endpoint 1 | ||
cluster = device.endpoints[1].ias_zone | ||
ias_zone_listener = ClusterListener(cluster) | ||
ias_zone_status_attr_id = IasZone.AttributeDefs.zone_status.id | ||
|
||
cluster.update_attribute(ias_zone_status_attr_id, 4) | ||
assert ( | ||
len(ias_zone_listener.attribute_updates) == 1 | ||
) # No update should occur for state >= 4 |
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.
What is the purpose of this test? The comment states "No update should occur for state >= 4", but the IAS zone status attribute update always happens, regardless of "state".
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.
Update: I've reworked the tests and removed this for now.
zhaquirks/linxura/__init__.py
Outdated
event_args = { | ||
BUTTON: button, | ||
PRESS_TYPE: press_type, | ||
COMMAND_ID: 10, |
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 remove the COMMAND_ID
fully, right?
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.
Update: I've also removed this for now.
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 tested locally, it looks good! Thank you!
Thanks for making the changes! Please have a look at the new code, let me know what you think, and try to see if everything works still. |
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.
Thanks for your contribution and for testing again!
I think everything looks good to go now.
Proposed change
This PR adds a new quirk for the Linxura smart controller's Zigbee mode, enabling Linxura smart controller proper communication and control within the ZHA framework. Linxura smart controller's Zigbee mode support four Zigbee buttons. Each button support click, double click, long press actions.
Additional information
Test file is in tests/test_linxura.py
Checklist
pre-commit
checks pass / the code has been formatted using Black