Ver Fonte

Light: Avoid exception when rgbhsv dp is missing.

When using persistent connections, we often get partial data.  Avoid an error
in this case.
Jason Rumney há 3 anos atrás
pai
commit
964c19c920
1 ficheiros alterados com 1 adições e 1 exclusões
  1. 1 1
      custom_components/tuya_local/generic/light.py

+ 1 - 1
custom_components/tuya_local/generic/light.py

@@ -129,7 +129,7 @@ class TuyaLocalLight(TuyaLocalEntity, LightEntity):
             color = self._rgbhsv_dps.decoded_value(self._device)
 
             fmt = self._rgbhsv_dps.format
-            if fmt:
+            if fmt and color:
                 vals = unpack(fmt.get("format"), color)
                 rgbhsv = {}
                 idx = 0