Repository navigation
Remove Parkside valve entities duplicated by its quirk - #1040
Draft
zigpy-review-bot wants to merge 1 commit into
Draft
zigpy-review-bot wants to merge 1 commit into
zigpy-review-bot wants to merge 1 commit into
Conversation
The Lidl Parkside watering timer (_TZE200_htnnfasr) has a v2 quirk that exposes a "Frost lock reset" button and a "Timer duration" number. ZHA's device-specific FrostLockResetButton and TimerDurationMinutes match the same Tuya cluster and write the same attributes, so the device ends up with two buttons and, once the timer duration has been reported, two numbers. Drop ZHA's copies and keep the quirk's.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #1040 +/- ##
==========================================
- Coverage 97.48% 97.48% -0.01%
==========================================
Files 61 61
Lines 10870 10848 -22
==========================================
- Hits 10597 10575 -22
Misses 273 273 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
zigpy-review-bot
left a comment
Collaborator
Author
There was a problem hiding this comment.
Would-be verdict: ready to merge. No blockers or must-address items. This is a COMMENT because it is the bot's own PR, and the PR is still a draft. Two notes and one related PR below.
- Behaviour changes for existing installs, beyond the orphaned entities the body names: the remaining "Frost lock reset" button has no device class (ZHA's copy had
restart, so its icon changes), and the remaining "Timer duration" number starts at 1 minute instead of 0. Zigbee2MQTT exposes the same 1–599 minute range for this valve's auto-off timer, so 0 was never a useful setting. This is worth a line in the release note, not a code change. - Optional follow-up: ZHA's
TimeLeftsensor for this valve (zha/application/platforms/sensor/__init__.py,_attribute_name = "timer_time_left") is dead code. The v2 quirk has notimer_time_leftattribute, so the sensor is never created; the quirk's own "Time left" sensor replaced it. Joining the valve with the installed quirk confirms this. It can go in this PR or in a separate cleanup; #1039 left it out on purpose. - Related: #1037, also a draft from the code audit, fixes the polarity of ZHA's
FrostLockbinary sensor on the same valve. The two PRs change different files and don't conflict. If maintainers want this PR's direction (the quirk owns the valve's entities), the alternative named in #1037 fits it: move the read-only frost lock sensor into the quirk and drop ZHA's copy. That choice is a maintainer's call.
Verified (6 checks)
- I joined the valve with the real v2 quirk from zha-quirks 2.4.1, at dev 2da1a5b and at the head 503bd83. On dev, the device gets two frost lock reset buttons (
FrostLockResetButtonplus the quirk'sWriteAttributeButton). Withtimer_durationcached, it also gets two timer duration numbers (TimerDurationMinutes0–599 plus the quirk's 1–599). Without a cached value, ZHA's number isn't created, as the body says. At the head, the device gets one of each. - Both changed tests fail on dev with
assert 2 == 1and pass at the head, so they actually test the duplication. - At the head: the full suite passes (1782 tests),
mypy zha/reports no issues, pre-commit is clean on the changed files, and CI is green. - Nothing else in zha or zha-quirks references
FrostLockResetButton,TimerDurationMinutesor thereset_frost_locktranslation key.TUYA_MANUFACTURER_CLUSTERis still used by other platforms.pyproject.tomlrequireszha-quirks>=2.4.0, which ships the v2 quirk. - Home Assistant's ZHA
strings.jsonhasfrost_lock_reset("Frost lock reset") andtimer_duration("Timer duration"), so the remaining entities keep their names.reset_frost_lockis unused once this merges. - A Copilot CLI pass raised one point, the 0 → 1 minimum. I checked it against Zigbee2MQTT's converter and folded it into the first note above.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Severity: low (the audit's estimate)
The Lidl Parkside smart watering timer (
_TZE200_htnnfasr/TS0601) gets its "Frost lock reset" button twice, and its "Timer duration" number twice once the timer duration has been reported. ZHA's device-specificFrostLockResetButtonandTimerDurationMinutesdate from before the valve's quirk exposed entities; since its conversion to a v2 quirk in zigpy/zha-device-handlers#3650 the quirk exposes the same button and number on the same attributes, under different unique IDs. This removes ZHA's copies and keeps the quirk's, the way #883 handled the Aqara pet feeder.Existing installs keep the quirk's button and number (same names); ZHA's copies (unique ID suffixes
61184-reset_frost_lockand61184-timer_duration) become orphaned in Home Assistant. Home Assistant'sreset_frost_lockbutton translation is unused afterwards and can be dropped there.Changes
zha/application/platforms/button/__init__.py: removeFrostLockResetButton(and the now unusedTUYA_MANUFACTURER_CLUSTERimport).zha/application/platforms/number/__init__.py: removeTimerDurationMinutes(and the now unused import).tests/test_button.py:test_frost_unlock(which already joins the valve with its v2 quirk) now checks that exactly one button writesfrost_lock_reset, and presses that one.tests/test_number.py: newtest_parkside_valve_timer_duration_not_duplicated, which caches atimer_durationvalue before the join and checks that exactly one number entity is created for it.Testing
assert 2 == 1(two buttons, two numbers) and pass with this change.Opened by the scheduled code audit; not requested by a maintainer.
Fixes #1039