-
Notifications
You must be signed in to change notification settings - Fork 40
Fix current_cover_tilt_position
for shades, add base class
#416
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #416 +/- ##
=======================================
Coverage 96.68% 96.69%
=======================================
Files 61 61
Lines 9834 9863 +29
=======================================
+ Hits 9508 9537 +29
Misses 326 326 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Could we derive both of them from a single abstract base class that implements the proper API? |
The added line is uncovered, but it looks like all ZHA tests generally use the Compared to accessing the state via |
Probably. |
The implementations don't share a lot, so the commit is really only the shared API used by HA and setting
(On an unrelated note, we should not really set |
current_cover_tilt_position
missing for shadescurrent_cover_tilt_position
for shades, add base class
Proposed change
This PR fixes an issue where the
current_cover_tilt_position
property was removed for theShade
implementation, based on theLevelControl
cluster (in #376).The Home Assistant integration does not differentiate between our
Cover
andShade
implementation, so tries to access thecurrent_cover_tilt_position
attribute/property regardless: https://github.com/home-assistant/core/blob/d23c9f715e1f7772ec8ae176f3db4b9afa7db95d/homeassistant/components/zha/cover.py#L122-L125We need to make sure we provide it in all our cover implementations, so this PR adds it back, returning
None
by default, as aShade
cannot support tilt.A new abstract
BaseCover
class is also added to make sure all relevant methods are implemented by theCover
andShade
implementations.Additional information
Should address:
We should likely add tests for this in HA in the future. I'm guessing
Shade
is not covered at all.