소스 검색

fix (cover): don't trust position when current_position is None

When current_position dp is defined, but the device is not
broadcasting it, we don't really know where the cover is.

This scenario arises because of multi-device configs, such as the
recent updates to simple_blinds.yaml, though it has been a possibility
for a while.
Jason Rumney 2 달 전
부모
커밋
d1d6c39335
1개의 변경된 파일5개의 추가작업 그리고 1개의 파일을 삭제
  1. 5 1
      custom_components/tuya_local/cover.py

+ 5 - 1
custom_components/tuya_local/cover.py

@@ -147,7 +147,11 @@ class TuyaLocalCover(TuyaLocalEntity, CoverEntity):
         elif pos > 95:
             return "opened"
 
-        if self._currentpos_dp and self._position_dp:
+        if (
+                self._currentpos_dp
+                and self._currentpos_dp.get_value(self._device) is not None
+                and self._position_dp
+        ):
             setpos = self._position_dp.get_value(self._device)
             if setpos == pos:
                 # if the current position is around the set position,