From c3200c81253256e93d15cf90df571b96c5ec930f Mon Sep 17 00:00:00 2001 From: Philipp Grimm Date: Wed, 27 Mar 2024 22:51:33 +0100 Subject: [PATCH] test cover position --- custom_components/eltako/cover.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/custom_components/eltako/cover.py b/custom_components/eltako/cover.py index 152bca21..7657e43b 100644 --- a/custom_components/eltako/cover.py +++ b/custom_components/eltako/cover.py @@ -241,6 +241,7 @@ def value_changed(self, msg): if self.dev_eep in [G5_3F_7F]: LOGGER.debug(f"[cover {self.dev_id}] G5_3F_7F - {decoded.__dict__}") + ## is received as response when button pushed if decoded.state == 0x02: # down self._attr_is_closing = True self._attr_is_opening = False @@ -259,6 +260,8 @@ def value_changed(self, msg): self._attr_is_closing = False self._attr_is_closed = False self._attr_current_cover_position = 100 + + ## is received when cover stops at a position elif decoded.time is not None and decoded.direction is not None and self._time_closes is not None and self._time_opens is not None: time_in_seconds = decoded.time / 10.0 @@ -271,9 +274,6 @@ def value_changed(self, msg): self._attr_current_cover_position = 0 self._attr_current_cover_position = min(self._attr_current_cover_position + int(time_in_seconds / self._time_opens * 100.0), 100) - self._attr_is_opening = True - self._attr_is_closing = False - self._attr_is_closed = None else: # down # If the latest state is unknown, the cover position @@ -283,9 +283,6 @@ def value_changed(self, msg): self._attr_current_cover_position = 100 self._attr_current_cover_position = max(self._attr_current_cover_position - int(time_in_seconds / self._time_closes * 100.0), 0) - self._attr_is_opening = False - self._attr_is_closing = True - self._attr_is_closed = None if self._attr_current_cover_position == 0: self._attr_is_closed = True