diff --git a/esphome/components/voice_assistant/voice_assistant.cpp b/esphome/components/voice_assistant/voice_assistant.cpp index 4001779edd..fb96d484d4 100644 --- a/esphome/components/voice_assistant/voice_assistant.cpp +++ b/esphome/components/voice_assistant/voice_assistant.cpp @@ -1,5 +1,7 @@ #include "voice_assistant.h" +#ifdef USE_VOICE_ASSISTANT + #include "esphome/core/log.h" #include @@ -192,3 +194,5 @@ VoiceAssistant *global_voice_assistant = nullptr; // NOLINT(cppcoreguidelines-a } // namespace voice_assistant } // namespace esphome + +#endif // USE_VOICE_ASSISTANT diff --git a/esphome/components/voice_assistant/voice_assistant.h b/esphome/components/voice_assistant/voice_assistant.h index bcfdb75a75..c1a6e8883b 100644 --- a/esphome/components/voice_assistant/voice_assistant.h +++ b/esphome/components/voice_assistant/voice_assistant.h @@ -1,5 +1,9 @@ #pragma once +#include "esphome/core/defines.h" + +#ifdef USE_VOICE_ASSISTANT + #include "esphome/core/automation.h" #include "esphome/core/component.h" #include "esphome/core/defines.h" @@ -86,3 +90,5 @@ extern VoiceAssistant *global_voice_assistant; // NOLINT(cppcoreguidelines-avoi } // namespace voice_assistant } // namespace esphome + +#endif // USE_VOICE_ASSISTANT