home-assistant-eltako
home-assistant-eltako copied to clipboard
Cover is driving all the way up or down until end position, if a small position correction is needed
I would like to suggest some modifications I have made to your integration and in more detail to the covers part. The goal of these changes is to prevent the covers from moving all the way up or down when only a small adjustment is needed.
I have adjusted the calculations in cover.py as follows:
Original:
time = min(int(((position - self._attr_current_cover_position) / 100.0) * self._time_opens), 255)
Changed to:
time = max(1, min(int((float(position - self._attr_current_cover_position) * float(self._time_opens) / 100.0)), 255))
and
Original:
time = min(int(((self._attr_current_cover_position - position) / 100.0) * self._time_closes), 255)
Changed to:
time = max(1, min(int((float(self._attr_current_cover_position - position) * float(self._time_closes) / 100.0)), 255))
Additionally, I modified lines 183 and 186 to ensure that the covers will move to the end position when 100 or 0 is set. This helps with calibration if the device is out of sync.
Original:
elif position == 100:
direction = "up"
time = self._time_opens + 1
elif position == 0:
direction = "down"
time = self._time_closes + 1
Changed to:
elif position == 100:
direction = "up"
time = 0 # self._time_opens + 1
elif position == 0:
direction = "down"
time = 0 # self._time_closes + 1
It would be great if you could incorporate these changes into your integration. Thank you very much for your excellent work and great commitment.