Skip to content

Commit

Permalink
Add triggers (defer did not work)
Browse files Browse the repository at this point in the history
  • Loading branch information
synesthesiam committed Sep 4, 2024
1 parent b984372 commit 3293e2c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions esphome/components/voice_assistant/voice_assistant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -923,9 +923,12 @@ void VoiceAssistant::timer_tick_() {
void VoiceAssistant::on_announce(const api::VoiceAssistantAnnounceRequest &msg) {
#ifdef USE_MEDIA_PLAYER
if (this->media_player_ != nullptr) {
this->tts_start_trigger_->trigger(msg.text);
this->announce_media_id_ = msg.media_id;
this->media_player_->make_call().set_media_url(msg.media_id).set_announcement(true).perform();
this->set_state_(State::STREAMING_RESPONSE, State::STREAMING_RESPONSE);
this->tts_end_trigger_->trigger(msg.media_id);
this->end_trigger_->trigger();
}
#endif
}
Expand Down
2 changes: 2 additions & 0 deletions esphome/components/voice_assistant/voice_assistant.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,11 @@ class VoiceAssistant : public Component {
flags |= VoiceAssistantFeature::FEATURE_TIMERS;
}

#ifdef USE_MEDIA_PLAYER
if (this->media_player_ != nullptr) {
flags |= VoiceAssistantFeature::FEATURE_ANNOUNCE;
}
#endif

return flags;
}
Expand Down

0 comments on commit 3293e2c

Please sign in to comment.