Skip to content
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

Improvements to Cover entity status handling #376

Open
wants to merge 7 commits into
base: dev
Choose a base branch
from

Conversation

jeverley
Copy link
Contributor

@jeverley jeverley commented Feb 7, 2025

Aims to address issues outlined in zigpy/zha-device-handlers#3686 (comment) where a cover gets stuck in opening/closing state.

Changes introduced

  • Fixes issue where the movement state instigated by 'go to' commands is not cleared upon completion
    • This was because previous targets were never being cleared
  • Implements movement timeout and previous sate comparison to determine device instigated changes
    • The timeout is initially calculated based on expected travel distance because some devices only report new position after stopping
    • A device position update will reduce the timeout to the default (5 seconds)
    • Tilt has a lower dynamic timeout range due to shorter physical travel distance on the tilt axis
  • Removed target position entity attributes (we don't need to restore these)
  • An open tilt state takes precedence over a closed lift state
  • Fix tests for tilt axis
  • Utilise CoverState class in const instead of string literals for state (follows approach used in core)

Addresses issues

Additional information

@jeverley jeverley force-pushed the cover-platform-entity-status branch 4 times, most recently from eb25950 to 7c14516 Compare February 9, 2025 11:45
Copy link

codecov bot commented Feb 9, 2025

Codecov Report

Attention: Patch coverage is 99.25926% with 1 line in your changes missing coverage. Please review.

Project coverage is 96.61%. Comparing base (d6bb4a8) to head (6d6e7fa).

Files with missing lines Patch % Lines
zha/application/platforms/cover/__init__.py 99.21% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #376      +/-   ##
==========================================
+ Coverage   96.58%   96.61%   +0.02%     
==========================================
  Files          61       61              
  Lines        9526     9608      +82     
==========================================
+ Hits         9201     9283      +82     
  Misses        325      325              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

This aims to address issues in correctly representing the current cover status.

 - Fixes issue where the movement state instigated by 'go to' commands is not cleared upon completion
 - Implements movement timeout and previous sate comparison to determine device instigated changes
 - Removed target position entity attributes (we don't need to restore these)
 - Fix tests for tilt axis
@jeverley jeverley marked this pull request as ready for review February 9, 2025 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant