Skip to content

Commit

Permalink
Merge pull request #88 from grimmpp/feature-branch
Browse files Browse the repository at this point in the history
test cover positions
  • Loading branch information
grimmpp authored Mar 27, 2024
2 parents 9dd5c27 + c3200c8 commit cd2a8d8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Elatko devices are exemplarily mentioned. You can find [here](https://www.eltako
* A5-04-01 (Temperature and Humidity Sensor)
* A5-04-02 (Temperature and Humidity Sensor e.g.: FLGTF, FLT58, FFT60)
* A5-04-03 (Temperature and Humidity Sensor e.g.: FFT60)
* A5-06-01 (Light - Twilight and Illumination)
* A5-06-01 (Light - Twilight and daylight in one sensor value)
* A5-07-01 (Occupancy sensor)
* A5-08-01 (Light-, Temperature-, Occupancy Sensor e.g.: FABH65S, FBH65, FBH65S, FBH65TF)
* A5-09-0C (Air Quality / VOC⁠ (Volatile Organic Compounds) e.g. [FLGTF](https://github.com/grimmpp/home-assistant-eltako/tree/main/docs/flgtf_temp_humidity_air_quality/readme.md))
Expand Down
15 changes: 8 additions & 7 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,15 +283,16 @@ 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
self._attr_is_opening = False
self._attr_is_closing = False
elif self._attr_current_cover_position == 100:
# elif self._attr_current_cover_position == 100:
# self._attr_is_closed = False
# self._attr_is_opening = False
# self._attr_is_closing = False
else:
self._attr_is_closed = False
self._attr_is_opening = False
self._attr_is_closing = False
Expand Down

0 comments on commit cd2a8d8

Please sign in to comment.