Improve the error message on OTA version mismatch (#6259)

This commit is contained in:
Sybren A. Stüvel 2024-02-22 02:35:21 +01:00 committed by GitHub
parent 481f067625
commit ea44166814
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -206,8 +206,11 @@ def perform_ota(
_, version = receive_exactly(sock, 2, "version", RESPONSE_OK) _, version = receive_exactly(sock, 2, "version", RESPONSE_OK)
_LOGGER.debug("Device support OTA version: %s", version) _LOGGER.debug("Device support OTA version: %s", version)
if version not in (OTA_VERSION_1_0, OTA_VERSION_2_0): supported_versions = (OTA_VERSION_1_0, OTA_VERSION_2_0)
raise OTAError(f"Unsupported OTA version {version}") if version not in supported_versions:
raise OTAError(
f"Device uses unsupported OTA version {version}, this ESPHome supports {supported_versions}"
)
# Features # Features
send_check(sock, FEATURE_SUPPORTS_COMPRESSION, "features") send_check(sock, FEATURE_SUPPORTS_COMPRESSION, "features")