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

Ensure a cover's supported features and attributes are respective of its window covering type attribute #410

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

Conversation

jeverley
Copy link
Contributor

@jeverley jeverley commented Apr 7, 2025

What's changed

  • The current_position and current_tilt_position state attributes now report None if their features are not supported by the device, resolves #142352
    • This is required because some devices are reporting a position of 0 rather than null
  • Revise supported_features logic so it excludes tilt only window covering types when enabling lift features
    • This means that lift features will still be enabled as a fallback if the window_covering_type attribute value is undefined by the device
    • Previously lift features were enabled for all devices, they should not be enabled for WCT.Shutter or WCT.Tilt_blind_tilt_only types, see Table 7-41. Window Covering Type from the Cluster Library Specification 07-5123 Revision 8

image

  • Updates to cover platform tests
    • Check lift only devices don't have tilt features enabled and that state attribute current_tilt_position is always None
    • Check tilt only devices don't have lift features enabled and that state attribute current_position is always None

Fixes issue

Related

FYI @TheJulianJES, @puddly, @dmulcahey

Copy link

codecov bot commented Apr 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.68%. Comparing base (2e8fbe8) to head (854e154).

Additional details and impacted files
@@           Coverage Diff           @@
##              dev     #410   +/-   ##
=======================================
  Coverage   96.68%   96.68%           
=======================================
  Files          61       61           
  Lines        9834     9838    +4     
=======================================
+ Hits         9508     9512    +4     
  Misses        326      326           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jeverley jeverley force-pushed the cover-handle-lift-only-devices-reporting-tilt-position branch from 90f300b to aab8119 Compare April 7, 2025 10:45
@jeverley jeverley force-pushed the cover-handle-lift-only-devices-reporting-tilt-position branch from aab8119 to d9cfa64 Compare April 7, 2025 10:46
@jeverley jeverley changed the title Amend _attr_supported_features logic and position attributes to respe… Ensure a cover's supported features and attributes are respective of its window covering type Apr 7, 2025
@jeverley jeverley changed the title Ensure a cover's supported features and attributes are respective of its window covering type Ensure a cover's supported features and attributes are respective of its window covering type attribute Apr 7, 2025
@jeverley jeverley force-pushed the cover-handle-lift-only-devices-reporting-tilt-position branch from dc502ce to 5953d0f Compare April 8, 2025 08:48
@@ -669,7 +676,7 @@ def state(self) -> dict[str, Any]:
@functools.cached_property
def supported_features(self) -> CoverEntityFeature:
"""Return supported features."""
return self._attr_supported_features
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency with the other platforms and attributes, let's keep the _attr prefix for now. These are meant to mirror those in Home Assistant: https://github.com/home-assistant/core/blob/3aae280de50a92cdfcf5c04b088fe9178fba0b2e/homeassistant/components/cover/__init__.py#L240

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @puddly, I've reverted the naming to include the _attr prefix, I've also adjusted the recompute_capabilities method so that it only updates the final value after evaluating all criteria.

jeverley added a commit to jeverley/zha that referenced this pull request Apr 9, 2025
…e HA cache

This adds a timeout for movement states restored from the entity cache.

Uses zigpy#410 as a base.
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.

Zigbee Soma Smart Shades 3 covers report OPEN state when closed
2 participants