-
Notifications
You must be signed in to change notification settings - Fork 879
Convert Schneider Electric shutters to quirks v2, expose entities #4130
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #4130 +/- ##
=======================================
Coverage 91.24% 91.24%
=======================================
Files 338 338
Lines 10921 10925 +4
=======================================
+ Hits 9965 9969 +4
Misses 956 956 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ad1b567
to
fa10863
Compare
Do you have any idea if it's possible to add a choice for the curtain type? It's currently "Tilt_blind_tilt_and_lift" when it should be an awning? I saw in the documentation that you posted that only the following values can be chosen: In my case, the Rollershade would be suitable for my situation, but when I try to change it via ZHA (on the Cluster "SEWindowCovering (Endpoint id: 5, Id: 0x0102, Type: in)" and the attribute "window_covering_type (id: 0x0000)" to 0, nothing happens. |
@Mookunicorn I don't have this shutter modules, so couldn't try it myself yet. But I'm planning to order them the following mouths. Can you try to set the value to |
Actually, it looks like this attribute is readonly, but in the spec doc it says the following:
Have you tried setting |
Ok it works using "WindowCoveringType.Rollershade" and I feel slightly stupid right now ☠️ |
After some tests, I noticed that changing the value of The same principle applies to Rollershade. |
So just to check if I understand it correctly.
|
That's right, I can try in the evening to change the value of |
async def test_1gang_shutter_1_go_to_lift_percentage_cmd(zigpy_device_from_quirk): | ||
"""Asserts that the go_to_lift_percentage command inverts the percentage value.""" | ||
|
||
device = zigpy_device_from_quirk( | ||
zhaquirks.schneiderelectric.shutters.OneGangShutter1 | ||
) | ||
window_covering_cluster = device.endpoints[5].window_covering | ||
|
||
p = mock.patch.object(window_covering_cluster, "request", mock.AsyncMock()) | ||
with p as request_mock: | ||
request_mock.return_value = (foundation.Status.SUCCESS, "done") | ||
|
||
await window_covering_cluster.go_to_lift_percentage(58) | ||
|
||
assert request_mock.call_count == 1 | ||
assert request_mock.call_args[0][1] == ( | ||
WindowCovering.ServerCommandDefs.go_to_lift_percentage.id | ||
) | ||
assert request_mock.call_args[0][3] == 42 # 100 - 58 | ||
|
||
|
||
async def test_1gang_shutter_1_unpatched_cmd(zigpy_device_from_quirk): | ||
"""Asserts that unpatched ZCL commands keep working.""" | ||
|
||
device = zigpy_device_from_quirk( | ||
zhaquirks.schneiderelectric.shutters.OneGangShutter1 | ||
) | ||
window_covering_cluster = device.endpoints[5].window_covering | ||
|
||
p = mock.patch.object(window_covering_cluster, "request", mock.AsyncMock()) | ||
with p as request_mock: | ||
request_mock.return_value = (foundation.Status.SUCCESS, "done") | ||
|
||
await window_covering_cluster.up_open() | ||
|
||
assert request_mock.call_count == 1 | ||
assert request_mock.call_args[0][1] == ( | ||
WindowCovering.ServerCommandDefs.up_open.id | ||
) | ||
|
||
|
||
async def test_1gang_shutter_1_lift_percentage_updates(zigpy_device_from_quirk): | ||
"""Asserts that updates to the ``current_position_lift_percentage`` attribute. | ||
(e.g., by the device) invert the reported percentage value. | ||
""" | ||
|
||
device = zigpy_device_from_quirk( | ||
zhaquirks.schneiderelectric.shutters.OneGangShutter1 | ||
) | ||
window_covering_cluster = device.endpoints[5].window_covering | ||
cluster_listener = ClusterListener(window_covering_cluster) | ||
|
||
window_covering_cluster.update_attribute( | ||
WindowCovering.AttributeDefs.current_position_lift_percentage.id, | ||
77, | ||
) | ||
|
||
assert len(cluster_listener.attribute_updates) == 1 | ||
assert cluster_listener.attribute_updates[0] == ( | ||
WindowCovering.AttributeDefs.current_position_lift_percentage.id, | ||
23, # 100 - 77 | ||
) | ||
assert len(cluster_listener.cluster_commands) == 0 |
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.
Ideally, we should keep the tests (except for the signature test). You should be able to use zigpy_device_from_v2_quirk
for the tests. Might need to search the repo for some examples.
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.
Good point, done.
e622641
to
721c3f9
Compare
|
It exposes a new entity but it ends up being duplicated. |
I was not aware of that, thank you for testing. Removed the duplicate entry again now. Then I'm not sure what else we can do here. @TheJulianJES let me know if you have any ideas how to make sure |
Add support for NHPB/SHUTTER/1 and PUCK/SHUTTER/1
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 IMO. Thanks!
Maybe open an issue for the |
Proposed change
Fixes #1685
Supersedes #3939
Additional information
#1705
ZB Spec - Micro Module Shutter Blinds - 110422.pdf
Checklist
pre-commit
checks pass / the code has been formatted using Black