Draft
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #734 +/- ##
==========================================
+ Coverage 97.63% 97.79% +0.16%
==========================================
Files 62 62
Lines 10814 10817 +3
==========================================
+ Hits 10558 10579 +21
+ Misses 256 238 -18 ☔ View full report in Codecov by Sentry. 🚀 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.
DRAFT. We need full test coverage first. This is also still experimental.
Proposed change
This adds a
_check_resultmethod to the light class that raises if the status is notSUCCESS.Depending on the
_ZCLFailureAction, the exception handling differs for the transition timing.#733 is also pulled in temporarily. Other clean-ups are applied as well.
Background
The light class basically works perfectly, except for turning off an effect when also switching color modes (affecting some lights). This would be fixed with PR #733. However, the light class also has potential to be cleaned up a bit.
In order to handle transitions and intermediate command failures correctly, you need a lot of conditionals to correctly handle all possible failure states. Other Zigbee implementations often do not do this correctly, causing incorrect state in Home Assistant when one command fails to deliver.
However, we can still clean up our light class a lot. One idea for this failed command handling is the one implemented in this PR. We likely want more test coverage for all edge-cases (group lights, assumed state, turn on after being turned off with a transition (internal brightness differs), ...) before trying any clean-up PRs though.
Additional information
Somewhat related:
Status.SUCCESSguards everywhere #678