fix: normalize ZNCLBL01LM terminal drift#12676
Open
martinfrancois wants to merge 1 commit into
Open
Conversation
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
This fixes a small but visible end-position issue with the Aqara
ZNCLBL01LMcurtain driver.After the curtain is told to fully open or fully close, the motor can stop at the real end of travel, but the device may still report a value that is just next to the end. For example, after opening to
100, it can later report99or98. After closing to0, it can later report1or2.Zigbee2MQTT then shows the curtain as not fully open or not fully closed, even though the command was for a full end position and the motor has already stopped.
#11911 already fixed one source of stale end-position reports from manufacturer attr
107. This PR handles the same kind of end-position drift when it comes from the other position paths this model uses:1055, which updatestarget_positionclosuresWindowCovering.currentPositionLiftPercentage, which updatespositionThe fix is intentionally narrow. For
ZNCLBL01LM, the converter now remembers when the recent context is a real end position (0or100). While the motor is stopped, it only normalizes values very close to that remembered end position:98or99becomes1001or2becomes0Safety
This does not blindly rewrite every
1,2,98, or99.Those values are only normalized when all of this is true:
ZNCLBL01LM0or100If a user explicitly asks for a non-end position, including
1,2,98, or99, the end-position context is cleared. That means those positions can still be used on purpose and should not be snapped back to0or100.The tests cover this for both normal and inverted cover configurations.
Scope
This PR only fixes the end-position settling problem after full open/close commands.
It does not try to fix separate partial-position behavior. In particular, explicit non-end-position commands are kept as non-end-position commands.
Testing
I also tested the change with a temporary Zigbee2MQTT external converter override for
ZNCLBL01LM:99/99100/100and0/01,2,98, or990or100AI Disclosure
Code and tests drafted with OpenAI Codex and reviewed, modified, and tested before submission.