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

fan: handle edge case where percentage is None

Some fans may have optional dp for speed. Avoid an error initialising
by avoiding exceptions in that case.

Issue #1513
Jason Rumney 1 год назад
Родитель
Сommit
66bda00b66
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      custom_components/tuya_local/fan.py

+ 1 - 1
custom_components/tuya_local/fan.py

@@ -117,7 +117,7 @@ class TuyaLocalFan(TuyaLocalEntity, FanEntity):
             return None
         r = self._speed_dps.range(self._device)
         val = self._speed_dps.get_value(self._device)
-        if r:
+        if r and val is not None:
             val = ranged_value_to_percentage(r, val)
         return val