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

Look for open closed state first #658

Merged
merged 1 commit into from
Nov 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions custom_components/tahoma/cover_devices/tahoma_cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,6 @@ async def async_set_cover_tilt_position(self, **kwargs):
def is_closed(self):
"""Return if the cover is closed."""

if self.current_cover_position is not None:
return self.current_cover_position == 0

state = self.executor.select_state(
CORE_OPEN_CLOSED_STATE,
CORE_SLATS_OPEN_CLOSED_STATE,
Expand All @@ -117,6 +114,10 @@ def is_closed(self):
if state is not None:
return state == STATE_CLOSED

# Keep this condition after the previous one. Some device like the pedestrian gate, always return 50 as position.
if self.current_cover_position is not None:
return self.current_cover_position == 0

if self.current_cover_tilt_position is not None:
return self.current_cover_tilt_position == 0

Expand Down