Skip to content

Commit 4776858

Browse files
authored
Improve cover state restoration from the HA entity cache (#412)
* Refresh cover state after the default timeout after restoring from the HA cache This adds a timeout for movement states restored from the entity cache. Uses #410 as a base. * Implement checks to ensure a movement state is not restored if the device has already reached the movement extrema - Updates tests to use a common mock cover device creation function to reduce code repetition * Remove `_is_completely_open` property and init `_state` with None - 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 * Ensure cover state restore and transition timer handles are cancelled upon entity removal * Add tests for on_remove timer cancellations * Make use of clear_transition methods to cancel timers on removal * Test cleanup * Add annotations for async_update test * Consolidate cover calls to `maybe_emit_state_changed_event` into `_determine_cover_position` function * Ensure position attributes are still updated when the state doesn't change
1 parent 18b2f77 commit 4776858

File tree

2 files changed

+225
-97
lines changed

2 files changed

+225
-97
lines changed

0 commit comments

Comments
 (0)