-
Notifications
You must be signed in to change notification settings - Fork 703
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 Tuya smoke detector TS0205 PST-YG500A #2991
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #2991 +/- ##
==========================================
+ Coverage 88.27% 88.30% +0.02%
==========================================
Files 302 303 +1
Lines 9447 9471 +24
==========================================
+ Hits 8339 8363 +24
Misses 1108 1108 ☔ View full report in Codecov by Sentry. |
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 the PR! I've added some suggestions.
Ideally, we should also add a test for the actual code (that translates the Tuya attribute to the IasZone
attribute).
This test can mostly be copied IMO:
zha-device-handlers/tests/test_xiaomi.py
Lines 781 to 809 in e4d0663
@pytest.mark.parametrize("quirk", (zhaquirks.xiaomi.aqara.smoke.LumiSensorSmokeAcn03,)) | |
async def test_aqara_smoke_sensor_attribute_update(zigpy_device_from_quirk, quirk): | |
"""Test update_attribute on Aqara smoke sensor.""" | |
device = zigpy_device_from_quirk(quirk) | |
opple_cluster = device.endpoints[1].opple_cluster | |
opple_listener = ClusterListener(opple_cluster) | |
ias_cluster = device.endpoints[1].ias_zone | |
ias_listener = ClusterListener(ias_cluster) | |
zone_status_id = IasZone.AttributeDefs.zone_status.id | |
# check that updating Xiaomi smoke attribute also updates zone status on the Ias Zone cluster | |
# turn on smoke alarm | |
opple_cluster.update_attribute(0x013A, 1) | |
assert len(opple_listener.attribute_updates) == 1 | |
assert len(ias_listener.attribute_updates) == 1 | |
assert ias_listener.attribute_updates[0][0] == zone_status_id | |
assert ias_listener.attribute_updates[0][1] == IasZone.ZoneStatus.Alarm_1 | |
# turn off smoke alarm | |
opple_cluster.update_attribute(0x013A, 0) | |
assert len(opple_listener.attribute_updates) == 2 | |
assert len(ias_listener.attribute_updates) == 2 | |
assert ias_listener.attribute_updates[1][0] == zone_status_id | |
assert ias_listener.attribute_updates[1][1] == 0 |
The opple cluster stuff just needs to be changed to the Tuya stuff (and the quirk path needs to be changed).
If you need help with adding this test, let me know and I'll add it, as soon as I have some time.
Hello, Are there any news to support the product in ZHA soon? I bought 4 of them... |
@cdalexndr Seems the pipeline failed at pre-commit step. Since you fixed it in the past (fa98480), any chance you could have a look again ? Looking forward to see this device recognized correctly and automatically in zha thanks to amazing community work like yours. |
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, I think this should be fine.
@cdalexndr why is the |
Just received a Product Safety Recall mail from Aliexpress about this smoke detector, just sharing in case you didn't know, I know what I need to replace ASAP :/ |
Proposed change
Additional information
Removed useless Opening sensor.
Changed motion sensor to smoke sensor.
Checklist
pre-commit
checks pass / the code has been formatted using Black