diff --git a/esphome/components/statsd/statsd.cpp b/esphome/components/statsd/statsd.cpp index 68b24908d2..b7fad19332 100644 --- a/esphome/components/statsd/statsd.cpp +++ b/esphome/components/statsd/statsd.cpp @@ -2,6 +2,7 @@ #include "statsd.h" +#ifdef USE_NETWORK namespace esphome { namespace statsd { @@ -154,3 +155,4 @@ void StatsdComponent::send_(std::string *out) { } // namespace statsd } // namespace esphome +#endif diff --git a/esphome/components/statsd/statsd.h b/esphome/components/statsd/statsd.h index ef42579587..34f84cbe00 100644 --- a/esphome/components/statsd/statsd.h +++ b/esphome/components/statsd/statsd.h @@ -3,6 +3,7 @@ #include #include "esphome/core/defines.h" +#ifdef USE_NETWORK #include "esphome/core/component.h" #include "esphome/components/socket/socket.h" #include "esphome/components/network/ip_address.h" @@ -84,3 +85,4 @@ class StatsdComponent : public PollingComponent { } // namespace statsd } // namespace esphome +#endif