diff --git a/esphome/components/udp/udp_component.h b/esphome/components/udp/udp_component.h index fb9b93e255..02f998ded7 100644 --- a/esphome/components/udp/udp_component.h +++ b/esphome/components/udp/udp_component.h @@ -70,7 +70,9 @@ class UDPComponent : public PollingComponent { } #endif void add_address(const char *addr) { this->addresses_.emplace_back(addr); } +#ifdef USE_NETWORK void set_listen_address(const char *listen_addr) { this->listen_address_ = network::IPAddress(listen_addr); } +#endif void set_port(uint16_t port) { this->port_ = port; } float get_setup_priority() const override { return setup_priority::AFTER_WIFI; } @@ -144,8 +146,9 @@ class UDPComponent : public PollingComponent { std::vector binary_sensors_{}; std::map> remote_binary_sensors_{}; #endif - +#ifdef USE_NETWORK optional listen_address_{}; +#endif std::map providers_{}; std::vector ping_header_{}; std::vector header_{};