Jelajahi Sumber

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 tahun lalu
induk
melakukan
8f24a0d0fe
1 mengubah file dengan 1 tambahan dan 1 penghapusan
  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: