rhasspy / wyoming-openwakeword

Wyoming protocol server for openWakeWord wake word detection system
MIT License
83 stars 23 forks source link

Wake word detection stops working #2

Closed dumpfheimer closed 8 months ago

dumpfheimer commented 8 months ago

Hi!

First of all, thanks for your work! I am absolutely psyched to have an offline voice assistant with wake word detection, absolutely fabulous 🚀

I am using Home Assistant's assistant with Wyoming piper + whisper + openwakeword. All 3 Wyoming apps are run via docker. Plus 3 Atom Echo running 2023.10.0b1

I have the following issue:

My wake word detection stops working after a few minutes. (Also, it seems like only one device at a time can check for a wake word)

I turned on debug logging for openwakeword and it stops after these lines:

DEBUG:wyoming_openwakeword.handler:Client connected: 343809002501645
DEBUG:wyoming_openwakeword.handler:Receiving audio from client: 343809002501645

I am guessing that a stalled connection is blocking the server from handling more requests, or something like this.

Before this I had multiple client connections per minute, now it's quiet.

Restarting the docker contsiner (and then reenabling wake word detection) fixes the issue.

It looks like the Wyoming server was meant to be asynchronous, so I'm not sure if this issue maybe should rather be in Wyoming project?

Thanks a lot!

diplix commented 8 months ago

i can confirm this behaviour when streaming audio via homeassistant satellite. while it’s working it’s absolutly amazing, however wakeword detection always stops after a while and i too have to restart the wyoming-openwakeword docker container to resume wake word detection. there’s no error logged in the container and i also guess the problem is related to the wyoming integration in home assistant or some kind of connection problem.

dumpfheimer commented 8 months ago

So, I dug a bit deeper into the code.

If I understand correctly, it is indeed the openwakeword part, that is preventing concurrent execution. (there are multiple locks in the code) This potentially leads to multiple problems:

Edit: This might actually be false. I found this in the logs, which invalidates what i thought might be happening, as it implies that two clients were simultaneously being listened to:

DEBUG:wyoming_openwakeword.handler:Client connected: 397713528567180
DEBUG:wyoming_openwakeword.handler:Receiving audio from client: 397713528567180
DEBUG:wyoming_openwakeword.handler:Client connected: 397722799133456
DEBUG:wyoming_openwakeword.handler:Receiving audio from client: 397722799133456
DEBUG:wyoming_openwakeword.handler:Client disconnected: 397713528567180
DEBUG:wyoming_openwakeword.handler:Client disconnected: 397722799133456
dumpfheimer commented 8 months ago

Okay, now my best bet is that it is a locking issue. There are, at some points, multiple locks acquired, and it seems like in different order, which could cause a deadlock

synesthesiam commented 8 months ago

Please update to version 1.8.0 of the add-on (or container)

thomclae33 commented 8 months ago

Updated the container to the latest version, but I have the same issue: after turning on the wakeword, it works once and after that stops working (unless I turn it back off and on again).

dumpfheimer commented 8 months ago

I have had similar issues. If you can fix it by turning off and on voice detection of the esp it is not the issue fixed in openwakeword.

Which Firmware are you using? Have you tried the 2023.10.1 firmware for the echo? Do you get an answer for your voice command?

thomclae33 commented 8 months ago

Thank you, an update to 2023.10.1 did the trick indeed!

pdarcos commented 7 months ago

Hi, I see this issue is now closed but I have the same problem and am not sure how to fix it. I am running ESPHome 2023.11.0 on my Echo but it seems to never detect the wake word (using the default OK Nabu)

Logs m5stack-atom-echo-869a5c.yaml INFO ESPHome 2023.11.0 INFO Reading configuration /config/esphome/m5stack-atom-echo-869a5c.yaml... INFO Updating https://github.com/esphome/esphome.git@pull/5230/head INFO Starting log output from m5stack-atom-echo-869a5c.local using esphome API INFO Successfully connected to m5stack-atom-echo-869a5c in 0.162s INFO Successful handshake with m5stack-atom-echo-869a5c in 0.094s [19:50:09][I][app:102]: ESPHome version 2023.11.0 compiled on Nov 15 2023, 17:45:13 [19:50:09][I][app:104]: Project m5stack.atom-echo-voice-assistant version 1.0

Core 2023.11.2 Supervisor 2023.11.3 Operating System 11.1 Frontend 2 0231030.2

Screenshot from 2023-11-15 19-44-24

Do I need to update or tweak anything to get it to work?

Thanks