Skip to content

Commit

Permalink
Guard implementation against no MWW
Browse files Browse the repository at this point in the history
  • Loading branch information
tetele authored and kahrendt committed Jan 17, 2025
1 parent 005b1e3 commit 4bc81f6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions esphome/components/voice_assistant/voice_assistant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,7 @@ void VoiceAssistant::on_announce(const api::VoiceAssistantAnnounceRequest &msg)
}

void VoiceAssistant::on_set_configuration(const std::vector<std::string> &active_wake_words) {
#ifdef USE_MICRO_WAKE_WORD
if (this->micro_wake_word_) {
// Disable all wake words first
for (auto &model : this->micro_wake_word_->get_wake_words()) {
Expand All @@ -912,12 +913,14 @@ void VoiceAssistant::on_set_configuration(const std::vector<std::string> &active
}
}
}
#endif
};

const Configuration &VoiceAssistant::get_configuration() {
this->config_.available_wake_words.clear();
this->config_.active_wake_words.clear();

#ifdef USE_MICRO_WAKE_WORD
if (this->micro_wake_word_) {
this->config_.max_active_wake_words = 1;

Expand All @@ -935,9 +938,12 @@ const Configuration &VoiceAssistant::get_configuration() {
this->config_.available_wake_words.push_back(std::move(wake_word));
}
} else {
#endif
// No microWakeWord
this->config_.max_active_wake_words = 0;
#ifdef USE_MICRO_WAKE_WORD
}
#endif

return this->config_;
};
Expand Down

0 comments on commit 4bc81f6

Please sign in to comment.