diff --git a/esphome/components/api/api_server.cpp b/esphome/components/api/api_server.cpp index 97a7d6fbf6..068f74315c 100644 --- a/esphome/components/api/api_server.cpp +++ b/esphome/components/api/api_server.cpp @@ -429,15 +429,16 @@ void APIServer::on_shutdown() { #ifdef USE_VOICE_ASSISTANT bool APIServer::start_voice_assistant() { - bool result = false; for (auto &c : this->clients_) { - result |= c->request_voice_assistant(true); + if (c->request_voice_assistant(true)) + return true; } - return result; + return false; } void APIServer::stop_voice_assistant() { for (auto &c : this->clients_) { - c->request_voice_assistant(false); + if (c->request_voice_assistant(false)) + return; } } #endif