mirror of
https://github.com/esphome/esphome.git
synced 2025-07-28 06:06:33 +00:00
[voice_assistant] Bugfix: Properly detect states where mic is running (#8745)
This commit is contained in:
parent
cdce59f7f9
commit
7f59aff157
@ -695,12 +695,12 @@ void VoiceAssistant::on_event(const api::VoiceAssistantEventResponse &msg) {
|
|||||||
}
|
}
|
||||||
case api::enums::VOICE_ASSISTANT_RUN_END: {
|
case api::enums::VOICE_ASSISTANT_RUN_END: {
|
||||||
ESP_LOGD(TAG, "Assist Pipeline ended");
|
ESP_LOGD(TAG, "Assist Pipeline ended");
|
||||||
if ((this->state_ == State::STARTING_PIPELINE) || (this->state_ == State::AWAITING_RESPONSE)) {
|
if ((this->state_ == State::START_PIPELINE) || (this->state_ == State::STARTING_PIPELINE) ||
|
||||||
// Pipeline ended before starting microphone
|
(this->state_ == State::STREAMING_MICROPHONE)) {
|
||||||
// Or there wasn't a TTS start event ("nevermind")
|
// Microphone is running, stop it
|
||||||
this->set_state_(State::IDLE, State::IDLE);
|
this->set_state_(State::STOP_MICROPHONE, State::IDLE);
|
||||||
} else if (this->state_ == State::STREAMING_MICROPHONE) {
|
} else if (this->state_ == State::AWAITING_RESPONSE) {
|
||||||
this->ring_buffer_->reset();
|
// No TTS start event ("nevermind")
|
||||||
this->set_state_(State::IDLE, State::IDLE);
|
this->set_state_(State::IDLE, State::IDLE);
|
||||||
}
|
}
|
||||||
this->defer([this]() { this->end_trigger_->trigger(); });
|
this->defer([this]() { this->end_trigger_->trigger(); });
|
||||||
|
Loading…
x
Reference in New Issue
Block a user