Skip to content

Commit

Permalink
test cover position
Browse files Browse the repository at this point in the history
  • Loading branch information
grimmpp committed Mar 27, 2024
1 parent 418142f commit c3200c8
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions custom_components/eltako/cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit c3200c8

Please sign in to comment.