From 950bbd05eb50aeaf1bcb814a8e920388f612600a Mon Sep 17 00:00:00 2001 From: kbx81 Date: Mon, 17 Aug 2026 18:26:05 -0500 Subject: [PATCH] Drop dead stub enum, gate get_modem_pins error ack on client 1.16, clarify ack comment --- esphome/components/api/api.proto | 6 +++--- esphome/components/api/api_connection.cpp | 5 +++++ .../stubs/esphome/components/serial_proxy/serial_proxy.h | 9 --------- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/esphome/components/api/api.proto b/esphome/components/api/api.proto index d43bbe1dd2..7dd877402e 100644 --- a/esphome/components/api/api.proto +++ b/esphome/components/api/api.proto @@ -2816,9 +2816,9 @@ message SerialProxyRequest { SerialProxyRequestType type = 2; // Request type } -// Acknowledges a serial proxy operation (subscribe, unsubscribe, flush, -// configure, or modem pin change). Sent since API 1.16; the type field -// identifies which operation is being acknowledged. +// Acknowledges a serial proxy operation; the type field identifies which +// operation is being acknowledged. Flush has been acknowledged since the +// message was introduced; all other acknowledgements are sent since API 1.16. message SerialProxyRequestResponse { option (id) = 147; option (source) = SOURCE_SERVER; diff --git a/esphome/components/api/api_connection.cpp b/esphome/components/api/api_connection.cpp index 961157b7ac..659ab45c2e 100644 --- a/esphome/components/api/api_connection.cpp +++ b/esphome/components/api/api_connection.cpp @@ -1632,6 +1632,11 @@ void APIConnection::on_serial_proxy_get_modem_pins_request(const SerialProxyGetM resp.instance = msg.instance; if (msg.instance >= proxies.size()) { ESP_LOGW(TAG, "Serial proxy instance %" PRIu32 " out of range", msg.instance); + // Pre-1.16 clients do not read the status field and would take this error + // for a successful "both pins deasserted" answer; let them time out as before + if (!this->client_supports_api_version(1, 16)) { + return; + } resp.status = enums::SERIAL_PROXY_STATUS_INVALID_ARGUMENT; } else { resp.line_states = proxies[msg.instance]->get_modem_pins(); diff --git a/tests/benchmarks/stubs/esphome/components/serial_proxy/serial_proxy.h b/tests/benchmarks/stubs/esphome/components/serial_proxy/serial_proxy.h index 16ba4327c5..6fc20f3350 100644 --- a/tests/benchmarks/stubs/esphome/components/serial_proxy/serial_proxy.h +++ b/tests/benchmarks/stubs/esphome/components/serial_proxy/serial_proxy.h @@ -13,15 +13,6 @@ namespace api { class APIConnection; } // namespace api -namespace uart { -enum class UARTFlushResult : uint8_t { - UART_FLUSH_RESULT_SUCCESS, - UART_FLUSH_RESULT_ASSUMED_SUCCESS, - UART_FLUSH_RESULT_TIMEOUT, - UART_FLUSH_RESULT_FAILED, -}; -} // namespace uart - namespace serial_proxy { enum class SerialProxyResult : uint8_t {