Browse Source

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 năm trước cách đây
mục cha
commit
8f24a0d0fe
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  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: