Skip to content

Commit 14084c8

Browse files
committed
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
1 parent 0dab6e9 commit 14084c8

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

custom_components/tuya_local/device.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,10 @@ def __init__(
127127
raise e
128128

129129
# we handle retries at a higher level so we can rotate protocol version
130-
self._api.set_socketRetryLimit(1)
130+
# on the other hand, protocol 3.4 devices send encrypted null ACKs that
131+
# often get mixed in, so we need to retry a couple of times before resorting
132+
# to recovery measures that seem to make things worse.
133+
self._api.set_socketRetryLimit(2)
131134
if self._api.parent:
132135
# Retries cause problems for other children of the parent device
133136
self._api.parent.set_socketRetryLimit(1)

0 commit comments

Comments
 (0)