Просмотр исходного кода

cover: In case of current_position at target, return opened

A previous bug report said that open control was disabled due to false being
returned from is_closed when it should be None.  But in cases where
current_position is correct, this is not the case, as HA knows it is in
between.

Issue #794, #715
Jason Rumney 2 лет назад
Родитель
Сommit
579a10b693
1 измененных файлов с 3 добавлено и 3 удалено
  1. 3 3
      custom_components/tuya_local/cover.py

+ 3 - 3
custom_components/tuya_local/cover.py

@@ -131,9 +131,9 @@ class TuyaLocalCover(TuyaLocalEntity, CoverEntity):
                 setpos = self._position_dp.get_value(self._device)
                 if setpos == pos:
                     # if the current position is around the set position,
-                    # probably the curtain is as set, somewhere in the middle
-                    # so none of opened, closed, opening or closing
-                    return None
+                    # which is not closed, then we want is_closed to return
+                    # false, so HA gets the full state from position.
+                    return "opened"
         if self._control_dp:
             cmd = self._control_dp.get_value(self._device)
             pos = self.current_cover_position