瀏覽代碼

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: