Add Tuya water leak sensor _TZE284_1di7ujzp#4845
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #4845 +/- ##
=======================================
Coverage 92.76% 92.76%
=======================================
Files 385 386 +1
Lines 12818 12833 +15
=======================================
+ Hits 11890 11905 +15
Misses 928 928 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds a new Tuya v2 quirk to support the Nous E13 water leak sensor (_TZE284_1di7ujzp / TS0601) so ZHA creates appropriate entities and interprets incoming Tuya DP reports.
Changes:
- Added a new Tuya quirk defining DPs for water presence/leak, battery, and configurable alarm settings.
- Added a dedicated test module that feeds Tuya frames into the Tuya manufacturer cluster and asserts resulting attribute updates.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
zhaquirks/tuya/ts0601_water_leak.py |
Registers a new TuyaQuirkBuilder-based quirk for the _TZE284_1di7ujzp TS0601 leak sensor (binary sensors + battery + enums). |
tests/test_tuya_water_leak.py |
Adds tests validating Tuya DP reports update the expected clusters/attributes for this device. |
| # device_version=1 | ||
| # input_clusters=[4, 5, 61184, 0, 60672] | ||
| # output_clusters=[25, 10]> | ||
| TuyaQuirkBuilder( |
There was a problem hiding this comment.
Can you wrap this with parentheses? See other quirks using TuyaQuirkBuilder or QuirkBuilder.
E.g. something like this:
(
QuirkBuilder("", "")
.something()
.add_to_registry()
)_TZE284_1di7ujzp
TheJulianJES
left a comment
There was a problem hiding this comment.
We also don't really need a test for this quirk, as it's basically a "definition-only quirk", with no code that needs to be tested.
And already thanks for the PR btw!
Proposed change
Add support for the Tuya water leak sensor
_TZE284_1di7ujzp/TS0601(Nous E13).Additional information
Added previously unsupported device and new quirk. I am new to quirks, so not sure if I met all criteria, please let me know if I did something wrong.
Should close #4823
Also added tests to verify the different datapoint values. Ran locally:
uv run pytest tests/test_tuya_water_leak.py -quv run pre-commit run --all-filesDevice diagnostics
zha-01JR32Z6V61S31ESE3H7JM9ZN5-_TZE284_1di7ujzp TS0601-c0f3253a6c179e9f9f4ac08ebb611adb.json
Checklist
pre-commitchecks pass / the code has been formatted using Black