From 2dd8a9913b5b639fc3e69ef2d49b909f0a2478be Mon Sep 17 00:00:00 2001 From: Mat931 <49403702+Mat931@users.noreply.github.com> Date: Fri, 1 May 2026 18:15:40 +0200 Subject: [PATCH] Fix --- esphome/components/esphome/ota/ota_esphome.h | 1 - esphome/espota2.py | 2 +- tests/unit_tests/test_espota2.py | 24 -------------------- 3 files changed, 1 insertion(+), 26 deletions(-) diff --git a/esphome/components/esphome/ota/ota_esphome.h b/esphome/components/esphome/ota/ota_esphome.h index 0431bd98e02..5043bc33ef8 100644 --- a/esphome/components/esphome/ota/ota_esphome.h +++ b/esphome/components/esphome/ota/ota_esphome.h @@ -91,7 +91,6 @@ class ESPHomeOTAComponent final : public ota::OTAComponent { std::string password_; std::unique_ptr auth_buf_; #endif // USE_OTA_PASSWORD - bool extended_proto_{false}; socket::ListenSocket *server_{nullptr}; std::unique_ptr client_; diff --git a/esphome/espota2.py b/esphome/espota2.py index 85e24abcb75..abf56ed67a3 100644 --- a/esphome/espota2.py +++ b/esphome/espota2.py @@ -65,7 +65,7 @@ SERVER_FEATURE_SUPPORTS_PARTITION_ACCESS = 0x02 # OTA types this client knows how to send. Future PRs that add bootloader/partition # updates extend this set. Anything outside the set is rejected up front so callers # of perform_ota/run_ota get a clear error instead of a post-auth 0x8E from the device. -_SUPPORTED_OTA_TYPES: frozenset[int] = frozenset({OTA_TYPE_UPDATE_APP}) +_SUPPORTED_OTA_TYPES: frozenset[int] = frozenset({OTA_TYPE_UPDATE_APP, OTA_TYPE_UPDATE_PARTITION_TABLE}) UPLOAD_BLOCK_SIZE = 8192 UPLOAD_BUFFER_SIZE = UPLOAD_BLOCK_SIZE * 8 diff --git a/tests/unit_tests/test_espota2.py b/tests/unit_tests/test_espota2.py index 04e08f90091..28e30bbe77f 100644 --- a/tests/unit_tests/test_espota2.py +++ b/tests/unit_tests/test_espota2.py @@ -892,30 +892,6 @@ def test_perform_ota_successful_partition_table( ) -@pytest.mark.usefixtures("mock_time") -def test_perform_ota_extended_protocol_unsupported( - mock_socket: Mock, mock_file: io.BytesIO -) -> None: - """Test OTA fails when extended protocol is required but unsupported.""" - # Setup socket responses for recv calls - recv_responses = [ - bytes([espota2.RESPONSE_OK]), # First byte of version response - bytes([espota2.OTA_VERSION_2_0]), # Version number - bytes([espota2.RESPONSE_HEADER_OK]), # Features response - ] - - mock_socket.recv.side_effect = recv_responses - - with pytest.raises(espota2.OTAError, match="Device only supports app updates"): - espota2.perform_ota( - mock_socket, - "testpass", - mock_file, - "partitions.bin", - espota2.OTA_TYPE_UPDATE_PARTITION_TABLE, - ) - - @pytest.mark.usefixtures("mock_time") def test_perform_ota_device_rejects_with_unsupported_ota_type( mock_socket: Mock, mock_file: io.BytesIO