Просмотр исходного кода

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 год назад
Родитель
Сommit
b270a1457a
1 измененных файлов с 1 добавлено и 1 удалено
  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,