mirror of
https://github.com/esphome/esphome.git
synced 2024-11-29 02:04:13 +01:00
Only request VA port from first client that is subscribed (#4747)
This commit is contained in:
parent
6f27126c8d
commit
55ec082628
1 changed files with 5 additions and 4 deletions
|
@ -429,15 +429,16 @@ void APIServer::on_shutdown() {
|
||||||
|
|
||||||
#ifdef USE_VOICE_ASSISTANT
|
#ifdef USE_VOICE_ASSISTANT
|
||||||
bool APIServer::start_voice_assistant() {
|
bool APIServer::start_voice_assistant() {
|
||||||
bool result = false;
|
|
||||||
for (auto &c : this->clients_) {
|
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() {
|
void APIServer::stop_voice_assistant() {
|
||||||
for (auto &c : this->clients_) {
|
for (auto &c : this->clients_) {
|
||||||
c->request_voice_assistant(false);
|
if (c->request_voice_assistant(false))
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue