Fix Soma cover tilt (#99717)

pull/96950/head
Tiit Rätsep 2023-09-11 12:15:46 +03:00 committed by GitHub
parent a4cb06d09f
commit 10bb8f5396
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -51,6 +51,8 @@ class SomaTilt(SomaEntity, CoverEntity):
| CoverEntityFeature.STOP_TILT
| CoverEntityFeature.SET_TILT_POSITION
)
CLOSED_UP_THRESHOLD = 80
CLOSED_DOWN_THRESHOLD = 20
@property
def current_cover_tilt_position(self) -> int:
@ -60,7 +62,12 @@ class SomaTilt(SomaEntity, CoverEntity):
@property
def is_closed(self) -> bool:
"""Return if the cover tilt is closed."""
return self.current_position == 0
if (
self.current_position < self.CLOSED_DOWN_THRESHOLD
or self.current_position > self.CLOSED_UP_THRESHOLD
):
return True
return False
def close_cover_tilt(self, **kwargs: Any) -> None:
"""Close the cover tilt."""