From 8be9f02693fdd383b4bfcde3fb3216068472cc3e Mon Sep 17 00:00:00 2001 From: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com> Date: Sun, 9 Feb 2025 23:42:40 -0500 Subject: [PATCH] [ota] Increase socket timeout earlier in OTA script (#8129) --- esphome/espota2.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/esphome/espota2.py b/esphome/espota2.py index 94b845b246..4f2a08fb4a 100644 --- a/esphome/espota2.py +++ b/esphome/espota2.py @@ -249,6 +249,9 @@ def perform_ota( send_check(sock, result, "auth result") receive_exactly(sock, 1, "auth result", RESPONSE_AUTH_OK) + # Set higher timeout during upload + sock.settimeout(30.0) + upload_size = len(upload_contents) upload_size_encoded = [ (upload_size >> 24) & 0xFF, @@ -271,8 +274,6 @@ def perform_ota( # show the actual progress sock.setsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF, UPLOAD_BUFFER_SIZE) - # Set higher timeout during upload - sock.settimeout(30.0) start_time = time.perf_counter() offset = 0