فهرست منبع

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 3 روز پیش
والد
کامیت
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:
         elif pos > 95:
             return "opened"
             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)
             setpos = self._position_dp.get_value(self._device)
             if setpos == pos:
             if setpos == pos:
                 # if the current position is around the set position,
                 # if the current position is around the set position,