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

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 лет назад
Родитель
Сommit
23ed078ecb
1 измененных файлов с 1 добавлено и 1 удалено
  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