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

Cover: position is considered unreliable, so lower its priority

Use binary open state before considering position, as that is a feedback
from the curtain, while position and action are the last commands sent
and not guaranteed to update when the curtain is controlled outside of
HA.

Where devices have a position dp that does provide accurate feedback on
current position, it should be duplicated in the config as both
position and current_position.
Jason Rumney 1 год назад
Родитель
Сommit
d4a2ac701b
1 измененных файлов с 4 добавлено и 4 удалено
  1. 4 4
      custom_components/tuya_local/cover.py

+ 4 - 4
custom_components/tuya_local/cover.py

@@ -97,15 +97,15 @@ class TuyaLocalCover(TuyaLocalEntity, CoverEntity):
             if pos is not None:
                 return pos
 
-        if self._position_dp:
-            pos = self._position_dp.get_value(self._device)
-            return pos
-
         if self._open_dp:
             state = self._open_dp.get_value(self._device)
             if state is not None:
                 return 100 if state else 0
 
+        if self._position_dp:
+            pos = self._position_dp.get_value(self._device)
+            return pos
+
         if self._action_dp:
             state = self._action_dp.get_value(self._device)
             return self._state_to_percent(state)