Преглед изворни кода

Avoid range checking non-numeric values.

Where there is a mapping from string values into a numeric HA representation,
we still need to report the range for the UI to function correctly, but do
not want to range check the values when setting, as the mapping should take
care of setting the correct values.

Should fix the exception when setting humidity in issue #263
Jason Rumney пре 3 година
родитељ
комит
8f24a0d0fe
1 измењених фајлова са 1 додато и 1 уклоњено
  1. 1 1
      custom_components/tuya_local/helpers/device_config.py

+ 1 - 1
custom_components/tuya_local/helpers/device_config.py

@@ -705,7 +705,7 @@ class TuyaDpsConfig:
                 )
 
         r = self.range(device, scaled=False)
-        if r:
+        if r and isinstance(result, (int, float)):
             minimum = r["min"]
             maximum = r["max"]
             if result < minimum or result > maximum: