Repository navigation
Apply light transition buffers in arrival order and for group members - #991
Open
zigpy-review-bot wants to merge 4 commits into
Open
zigpy-review-bot wants to merge 4 commits into
zigpy-review-bot wants to merge 4 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## zigpy-bot/light-command-failure-coverage #991 +/- ##
=========================================================================
Coverage 97.81% 97.81%
=========================================================================
Files 61 61
Lines 10878 10896 +18
=========================================================================
+ Hits 10640 10658 +18
Misses 238 238 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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
Fixes the two edge cases left open in #988 after #989. Stacked on #990, which is stacked on #989.
on_off/ level reports buffered while the group's transition runs were never applied: the group's completion only cleared the member's flag. They are now applied (and the member's state written) when the group transition ends, unless the member is still in a transition of its own, whose completion applies them.on_off=Truereport followed bycurrent_level=0in the same window resolved to on, because the zero level was applied before the on_off buffer. A zero level is now buffered as anon_off=Falsereport, so the last report of the window wins regardless of its kind; a later non-zero level report restores whatever on_off report the zero replaced (an off command steps the level to 0 and back, a late 0 during a turn on is followed by the rising level), and a genuineon_off=Falsereport is never cancelled by a level report.Closes #988.
Changes
zha/application/platforms/light/__init__.py: the buffer application is extracted into_apply_transition_buffers, used byasync_transition_completeandLight.transition_off;Light.transition_ondrops a member's buffers left over from an earlier group transition (unless the member is in a transition of its own); a level 0 report goes into the on_off buffer (remembering what it replaced) instead of the brightness buffer.tests/test_light.py:test_zero_level_and_on_off_reports_apply_in_arrival_order(ten orderings, in an off and an on window),test_group_member_reports_applied_when_group_transition_endsandtest_group_member_buffer_dropped_when_group_transition_restarts. The arrival-order and member-apply tests fail without the change; the restart test guards the new apply path.Testing
tests/test_light.pypasses (47 tests) and the full suite passes, pre-commit passes.