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

Handle missing action in covers.

Alternate way of handling the behaviour of PR #655.
Jason Rumney 2 лет назад
Родитель
Сommit
a03f0f9494

+ 1 - 0
ACKNOWLEDGEMENTS.md

@@ -251,3 +251,4 @@ Further device support has been made with the assistance of users.  Please consi
 - [tomassj9](https://github.com/tomassj9) for contributing support for Moes 3-gang switches.
 - [pdw-mb](https://github.com/pdw-mb) for contributing support for inow heater element with dual air and water temperature control.
 - [ianalexander](https://github.com/ianalexander) for contributing support for Zemismart roller shade, which was merged into loratap curtain switch config.
+- [xZetsubou](https://github.com/xZetsubou) for contributing improvements for covers to better support Zemismart roller shades.

+ 6 - 2
custom_components/tuya_local/cover.py

@@ -117,7 +117,9 @@ class TuyaLocalCover(TuyaLocalEntity, CoverEntity):
         """Return if the cover is opening or not."""
         # If dps is available to inform current action, use that
         if self._action_dp:
-            return self._action_dp.get_value(self._device) == "opening"
+            action = self._action_dp.get_value(self._device)
+            if action is not None:
+                return action == "opening"
         # Otherwise use last command and check it hasn't completed
         if self._control_dp:
             pos = self.current_cover_position
@@ -132,7 +134,9 @@ class TuyaLocalCover(TuyaLocalEntity, CoverEntity):
         """Return if the cover is closing or not."""
         # If dps is available to inform current action, use that
         if self._action_dp:
-            return self._action_dp.get_value(self._device) == "closing"
+            action = self._action_dp.get_value(self._device)
+            if action is not None:
+                return action == "closing"
         # Otherwise use last command and check it hasn't completed
         if self._control_dp:
             closed = self.is_closed

+ 1 - 1
custom_components/tuya_local/devices/zemismart_roller_shade.yaml

@@ -86,7 +86,7 @@ secondary_entities:
         type: string
         name: option
         mapping:
-          - dps_val: continuation
+          - dps_val: contiuation
             value: Auto
           - dps_val: point
             value: Manual