Implement external state restoration#58
Merged
puddly merged 37 commits intoJul 5, 2024
Merged
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #58 +/- ##
==========================================
+ Coverage 95.00% 95.25% +0.25%
==========================================
Files 61 61
Lines 9306 9335 +29
==========================================
+ Hits 8841 8892 +51
+ Misses 465 443 -22 ☔ View full report in Codecov by Sentry. |
dmulcahey
reviewed
Jul 2, 2024
This reverts commit 7ef8ba3.
TheJulianJES
reviewed
Jul 3, 2024
Co-authored-by: TheJulianJES <TheJulianJES@users.noreply.github.com>
Contributor
Author
|
I've foregone using the ZCL cache and instead just implement |
TheJulianJES
reviewed
Jul 5, 2024
TheJulianJES
approved these changes
Jul 5, 2024
TheJulianJES
left a comment
Contributor
There was a problem hiding this comment.
Also looks good IMO
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.
A few platforms in ZHA uses instance attributes and complex logic to derive their state, relying on Home Assistant to persist it and restore it after startup:
lightandcover) for Home Assistant to store this information as extra state attributes, allowing it to be restore properly. I believe this was actually a bug in the past.binary_sensorandlock. These effectively perform operations that change a ZCL attribute so the attribute cache can be used to maintain state.statefrom other information and unfortunately will have to be directly restored (siren).In the future, we need to explore a way to store this extra state. I think zigpy can provide a hook. Alternatively, we can invert the storage logic and have ZHA implement a database driver for zigpy.