diff --git a/esphome/components/udp/udp_component.cpp b/esphome/components/udp/udp_component.cpp index 799ed813d3..3fcef9e4f9 100644 --- a/esphome/components/udp/udp_component.cpp +++ b/esphome/components/udp/udp_component.cpp @@ -3,6 +3,7 @@ #include "esphome/components/network/util.h" #include "udp_component.h" +#ifdef USE_NETWORK namespace esphome { namespace udp { @@ -614,3 +615,4 @@ void UDPComponent::send_ping_pong_request_() { } } // namespace udp } // namespace esphome +#endif diff --git a/esphome/components/udp/udp_component.h b/esphome/components/udp/udp_component.h index 69bf335a90..bbe46a562f 100644 --- a/esphome/components/udp/udp_component.h +++ b/esphome/components/udp/udp_component.h @@ -1,6 +1,7 @@ #pragma once #include "esphome/core/component.h" +#ifdef USE_NETWORK #ifdef USE_SENSOR #include "esphome/components/sensor/sensor.h" #endif @@ -156,3 +157,4 @@ class UDPComponent : public PollingComponent { } // namespace udp } // namespace esphome +#endif