-
Notifications
You must be signed in to change notification settings - Fork 55
Improve cover state restoration from the HA entity cache #412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve cover state restoration from the HA entity cache #412
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #412 +/- ##
=======================================
Coverage 96.67% 96.67%
=======================================
Files 61 61
Lines 9987 9992 +5
=======================================
+ Hits 9655 9660 +5
Misses 332 332 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
1e4e331 to
8b15410
Compare
11609df to
8a251dd
Compare
|
I've rebased this PR on top of |
Thanks @puddly, this one should be ready for review now too. |
a15538a to
765324b
Compare
…e HA cache This adds a timeout for movement states restored from the entity cache. Uses zigpy#410 as a base.
…vice has already reached the movement extrema - Updates tests to use a common mock cover device creation function to reduce code repetition
- We init `_state` with None and let the `_determine_cover_state` function populate the value from current positions - Ensures all lines are coverable by tests
… upon entity removal
0d55d6a to
27cda67
Compare
f86216b to
1a28055
Compare
fb0abe2 to
ff977f0
Compare
…termine_cover_position` function
7d7f656 to
28429be
Compare
What's changed
This PR handles edge cases in restoring state after ZHA has been offline.
The current behaviour results in the cover stuck in a restored
OPENING/CLOSINGstate until the device reports a position update (could be up to 5 mins with some devices).We also currently restore open/closed state regardless of the device's actual position.
The below changes have been made to handle state restoration correctly
CLOSING/OPENINGstatesCLOSED/completelyOPEN(i.e. 100%)CLOSED/OPENstates, instead the state is determined from current position during initOther improvements
Updates to cover tests