[tcp_uart][uart_tcp] Expose the no-arg load_settings() and mark UartTcp final (#20163)

This commit is contained in:
Bascht74
2026-10-05 08:47:18 -05:00
committed by GitHub
parent 862047386c
commit 59b49d34cc
4 changed files with 18 additions and 1 deletions
+1
View File
@@ -44,6 +44,7 @@ class TcpUart : public uart::UARTComponent, public Component {
bool is_connected() override { return this->link_.connected(); }
#if defined(USE_ESP8266) || defined(USE_ESP32)
void load_settings(bool dump_config) override {}
using UARTComponent::load_settings; // also bring in the no-arg overload for convenience
#endif
protected:
+1 -1
View File
@@ -14,7 +14,7 @@
namespace esphome::uart_tcp {
/// Copies raw bytes between one hardware UART and one TCP socket.
class UartTcp : public Component, public uart::UARTDevice {
class UartTcp final : public Component, public uart::UARTDevice {
public:
void set_host(const char *host) { this->link_.set_host(host); }
void set_port(uint16_t port) { this->link_.set_port(port); }
@@ -1,2 +1,10 @@
packages:
tcp_uart: !include common.yaml
# load_settings() exists on ESP8266 and ESP32 only; both overloads must resolve.
interval:
- interval: 60s
then:
- lambda: |-
id(tcp_uart_server).load_settings();
id(tcp_uart_server).load_settings(false);
@@ -1,2 +1,10 @@
packages:
tcp_uart: !include common.yaml
# load_settings() exists on ESP8266 and ESP32 only; both overloads must resolve.
interval:
- interval: 60s
then:
- lambda: |-
id(tcp_uart_server).load_settings();
id(tcp_uart_server).load_settings(false);