From 9a7ab80c43978f50c5a7db80e0104b173c07bf2f Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 16 Aug 2026 21:16:53 -0500 Subject: [PATCH] [uart] Clear the driver installed flag only after a successful delete A failed uart_driver_delete leaves the old driver installed and working; clearing the flag beforehand would gate off a live driver. --- esphome/components/uart/uart_component_esp_idf.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/esphome/components/uart/uart_component_esp_idf.cpp b/esphome/components/uart/uart_component_esp_idf.cpp index 8a3aa98321..0441723937 100644 --- a/esphome/components/uart/uart_component_esp_idf.cpp +++ b/esphome/components/uart/uart_component_esp_idf.cpp @@ -126,13 +126,15 @@ void IDFUARTComponent::load_settings(bool dump_config) { esp_err_t err; if (uart_is_driver_installed(this->uart_num_)) { - this->driver_installed_ = false; err = uart_driver_delete(this->uart_num_); if (err != ESP_OK) { ESP_LOGW(TAG, "uart_driver_delete failed: %s", esp_err_to_name(err)); this->mark_failed(); return; } + // Only mark the driver gone once the delete actually succeeded; a failed + // delete leaves the old driver installed and working + this->driver_installed_ = false; } err = uart_driver_install(this->uart_num_, // UART number this->rx_buffer_size_, // RX ring buffer size