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

fix(devices): increase socket retry limit

null ACKs from protocol 3.4 devices require us to retry to get the
actual response to a previous command.

With only one retry, eventually we strike a timing that two null ACKS
come before the response, so the connection gets treated as broken.

This will lengthen time taken to detect actual connection problems, and
to make our way through all the protocol versions in auto mode,
but seems to be necessary to get reliable communications back after several
AI submitted fixes for actual problems caused side effects for these 3.4
devices.

https://github.com/jasonacox/tinytuya/blob/master/PROTOCOL.md#troubleshooting-tips

Issue #5136
Jason Rumney 1 день назад
Родитель
Сommit
14084c8dca
1 измененных файлов с 4 добавлено и 1 удалено
  1. 4 1
      custom_components/tuya_local/device.py

+ 4 - 1
custom_components/tuya_local/device.py

@@ -127,7 +127,10 @@ class TuyaLocalDevice(object):
             raise e
 
         # we handle retries at a higher level so we can rotate protocol version
-        self._api.set_socketRetryLimit(1)
+        # on the other hand, protocol 3.4 devices send encrypted null ACKs that
+        # often get mixed in, so we need to retry a couple of times before resorting
+        # to recovery measures that seem to make things worse.
+        self._api.set_socketRetryLimit(2)
         if self._api.parent:
             # Retries cause problems for other children of the parent device
             self._api.parent.set_socketRetryLimit(1)