Skip to content

Commit

Permalink
Look for open closed state first
Browse files Browse the repository at this point in the history
  • Loading branch information
tetienne committed Nov 19, 2021
1 parent 1c30822 commit 57d7a8e
Showing 1 changed file with 4 additions and 3 deletions.
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

0 comments on commit 57d7a8e

Please sign in to comment.