Kaynağa Gözat

debug(device): add logs to all paths that deliberately close connections

Protocol 3.4 devices seem to be affected by an issue where the device fails to respond
after a while and starts rejecting connections as if the device id or local key are
wrong until the device itself is rebooted.

The issue seems to be triggered by something the integration does, possibly there is a
limitation on number of connections which we are burning through too fast. This change
ensures that something is logged whenever the connection gets broken by the integration,
so we can start to track down what exactly is triggering the issue.

Issue #5347
Jason Rumney 4 hafta önce
ebeveyn
işleme
2c23224721
1 değiştirilmiş dosya ile 2 ekleme ve 0 silme
  1. 2 0
      custom_components/tuya_local/device.py

+ 2 - 0
custom_components/tuya_local/device.py

@@ -311,6 +311,7 @@ class TuyaLocalDevice(object):
 
     def pause(self):
         self._temporary_poll = True
+        _LOGGER.debug("%s pausing connection temporarily", self.name, False)
         self._api.set_socketPersistent(False)
         if self._api.parent:
             self._api.parent.set_socketPersistent(False)
@@ -425,6 +426,7 @@ class TuyaLocalDevice(object):
                 self._running = False
                 # Close the persistent connection when exiting the loop
                 persist = False
+                _LOGGER.debug("%s receive loop interrupted", self.name)
                 self._api.set_socketPersistent(False)
                 if self._api.parent:
                     self._api.parent.set_socketPersistent(False)