Przeglądaj źródła

Let integers pass as float for auto-detection.

A value of 0 has a type of int, but it can also be a float.

Issue #335
Jason Rumney 3 lat temu
rodzic
commit
6aefc8da90

+ 4 - 0
custom_components/tuya_local/helpers/device_config.py

@@ -21,6 +21,10 @@ def _typematch(type, value):
     if type is int and isinstance(value, bool):
     if type is int and isinstance(value, bool):
         return False
         return False
 
 
+    # Allow integers to pass as floats.
+    if type is float and isinstance(value, int):
+        return True
+
     if isinstance(value, type):
     if isinstance(value, type):
         return True
         return True
     # Allow values embedded in strings if they can be converted
     # Allow values embedded in strings if they can be converted