From 57d7a8e95ac7ea265659c902b83f3ba196d04ea8 Mon Sep 17 00:00:00 2001 From: Thibaut Etienne Date: Fri, 19 Nov 2021 08:49:51 +0000 Subject: [PATCH] Look for open closed state first --- custom_components/tahoma/cover_devices/tahoma_cover.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/custom_components/tahoma/cover_devices/tahoma_cover.py b/custom_components/tahoma/cover_devices/tahoma_cover.py index 8fd4e3374..993920bc8 100644 --- a/custom_components/tahoma/cover_devices/tahoma_cover.py +++ b/custom_components/tahoma/cover_devices/tahoma_cover.py @@ -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, @@ -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