Jelajahi Sumber

Config: return match quality of 0 when there are no keys

If there are no keys to match, avoid a divide by zero exception.
Jason Rumney 1 tahun lalu
induk
melakukan
b270a1457a
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

@@ -200,7 +200,7 @@ class TuyaDeviceConfig:
         if "updated_at" in keys:
             keys.remove("updated_at")
         total = len(keys)
-        if not self._entity_match_analyse(
+        if total < 1 or not self._entity_match_analyse(
             self.primary_entity,
             keys,
             matched,