Przeglądaj źródła

light: color_mode. Don't do mired conversion on non-numeric values

Avoid an exception in color_mode due to mired conversion, which occurs even
when the value is not inverted.
Jason Rumney 3 lat temu
rodzic
commit
23ed078ecb
1 zmienionych plików z 1 dodań i 1 usunięć
  1. 1 1
      custom_components/tuya_local/generic/light.py

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

@@ -95,7 +95,7 @@ class TuyaLocalLight(TuyaLocalEntity, LightEntity):
         if self._color_temp_dps:
             unscaled = self._color_temp_dps.get_value(self._device)
             r = self._color_temp_dps.range(self._device)
-            if r:
+            if r and isinstance(unscaled, (int, float)):
                 return round(unscaled * 347 / (r["max"] - r["min"]) + 153 - r["min"])
             else:
                 return unscaled