Procházet zdrojové kódy

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 před 2 roky
rodič
revize
66bda00b66
1 změnil soubory, kde provedl 1 přidání a 1 odebrání
  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