mirror of
https://github.com/esphome/esphome.git
synced 2025-09-28 16:12:24 +01:00
Replace API deferred queue with efficient message batching system (#9012)
This commit is contained in:
@@ -223,7 +223,7 @@ void VoiceAssistant::loop() {
|
||||
msg.wake_word_phrase = this->wake_word_;
|
||||
this->wake_word_ = "";
|
||||
|
||||
if (this->api_client_ == nullptr || !this->api_client_->send_voice_assistant_request(msg)) {
|
||||
if (this->api_client_ == nullptr || !this->api_client_->send_message(msg)) {
|
||||
ESP_LOGW(TAG, "Could not request start");
|
||||
this->error_trigger_->trigger("not-connected", "Could not request start");
|
||||
this->continuous_ = false;
|
||||
@@ -245,7 +245,7 @@ void VoiceAssistant::loop() {
|
||||
if (this->audio_mode_ == AUDIO_MODE_API) {
|
||||
api::VoiceAssistantAudio msg;
|
||||
msg.data.assign((char *) this->send_buffer_, read_bytes);
|
||||
this->api_client_->send_voice_assistant_audio(msg);
|
||||
this->api_client_->send_message(msg);
|
||||
} else {
|
||||
if (!this->udp_socket_running_) {
|
||||
if (!this->start_udp_socket_()) {
|
||||
@@ -331,7 +331,7 @@ void VoiceAssistant::loop() {
|
||||
|
||||
api::VoiceAssistantAnnounceFinished msg;
|
||||
msg.success = true;
|
||||
this->api_client_->send_voice_assistant_announce_finished(msg);
|
||||
this->api_client_->send_message(msg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -580,7 +580,7 @@ void VoiceAssistant::signal_stop_() {
|
||||
ESP_LOGD(TAG, "Signaling stop");
|
||||
api::VoiceAssistantRequest msg;
|
||||
msg.start = false;
|
||||
this->api_client_->send_voice_assistant_request(msg);
|
||||
this->api_client_->send_message(msg);
|
||||
}
|
||||
|
||||
void VoiceAssistant::start_playback_timeout_() {
|
||||
@@ -590,7 +590,7 @@ void VoiceAssistant::start_playback_timeout_() {
|
||||
|
||||
api::VoiceAssistantAnnounceFinished msg;
|
||||
msg.success = true;
|
||||
this->api_client_->send_voice_assistant_announce_finished(msg);
|
||||
this->api_client_->send_message(msg);
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user