tetele / onju-voice-satellite

An ESPHome config for the Onju Voice which makes it a Home Assistant voice satellite
MIT License
63 stars 7 forks source link

bugfix: on_end race condition / Speaker buffer full #36

Closed cowboyrushforth closed 1 month ago

cowboyrushforth commented 1 month ago

"on_end" appears to be called before "on_tts_stream_end" usually this is fine because the previous yaml would wait for the speaker to stop playing to continue. but if the speaker has not started playing in the 500ms delay, then you get a race and we try to end before we actually start outputting audio

this can cause the system to become unstable, and output "Speaker buffer full, trying again next loop" over and over and over again for a long time.

tested with esphome 2024.04

tetele commented 1 month ago

Very good catch, thanks!

I can't test at the moment, but it seems like a very logical change, I'll merge it as is