mirror of
https://github.com/esphome/esphome.git
synced 2026-10-07 11:26:39 +00:00
[tcp_uart][uart_tcp] Expose the no-arg load_settings() and mark UartTcp final (#20163)
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user