Procházet zdrojové kódy

Add connection logging around pause/resume

For easier debugging of issues like #968
Jason Rumney před 2 roky
rodič
revize
6cee1f9305

+ 2 - 0
custom_components/tuya_local/config_flow.py

@@ -194,6 +194,7 @@ async def async_test_connection(config: dict, hass: HomeAssistant):
     domain_data = hass.data.get(DOMAIN)
     existing = domain_data.get(get_device_id(config)) if domain_data else None
     if existing:
+        _LOGGER.info("Pausing existing device to test new connection parameters")
         existing["device"].pause()
         await asyncio.sleep(5)
 
@@ -216,6 +217,7 @@ async def async_test_connection(config: dict, hass: HomeAssistant):
         retval = None
 
     if existing:
+        _LOGGER.info("Restarting device after test")
         existing["device"].resume()
 
     return retval

+ 1 - 0
custom_components/tuya_local/device.py

@@ -263,6 +263,7 @@ class TuyaLocalDevice(object):
                     # the protocol version, which seems to require a fresh
                     # connection.
                     persist = not self.should_poll
+                    _LOGGER.debug("%s persistant connection set to %s", self.name, persist)
                     self._api.set_socketPersistent(persist)
                     if self._api.parent:
                         self._api.parent.set_socketPersistent(persist)