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

Device: avoid repeatedly logging connection failures as error.

When a connection has been dropped, log the error once, don't keep logging
every time a retry fails.
Jason Rumney 1 год назад
Родитель
Сommit
81ff853325
1 измененных файлов с 4 добавлено и 3 удалено
  1. 4 3
      custom_components/tuya_local/device.py

+ 4 - 3
custom_components/tuya_local/device.py

@@ -594,9 +594,10 @@ class TuyaLocalDevice(object):
                         > self._AUTO_FAILURE_RESET_COUNT
                     ):
                         self._api_protocol_working = False
-                    for entity in self._children:
-                        entity.async_schedule_update_ha_state()
-                    _LOGGER.error(error_message)
+                        for entity in self._children:
+                            entity.async_schedule_update_ha_state()
+                    if self._api_working_protocol_failures == 1:
+                        _LOGGER.error(error_message)
 
                 if not self._api_protocol_working:
                     await self._rotate_api_protocol_version()