Add speech-to-text cooldown for local wake word (#108806)

* Deconflict based on wake word

* Undo test

* Make wake up key a string, rename error

* Update snapshot

* Change to "wake word phrase" and normalize

* Move normalization into the wake provider

* Working on describe

* Use satellite info to resolve wake word phrase

* Add test for wake word phrase

* Match phrase with model name in wake word provider

* Check model id

* Use one constant wake word cooldown

* Update homeassistant/components/assist_pipeline/error.py

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>

* Fix wake word tests

---------

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
Michael Hansen 2024-02-26 19:35:19 -06:00 committed by GitHub
parent c38e0d22b8
commit f6622ea8e0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 641 additions and 184 deletions

View file

@ -201,16 +201,19 @@ class MockWakeWordEntity(wake_word.WakeWordDetectionEntity):
if self.alternate_detections:
detected_id = wake_words[self.detected_wake_word_index].id
detected_name = wake_words[self.detected_wake_word_index].name
self.detected_wake_word_index = (self.detected_wake_word_index + 1) % len(
wake_words
)
else:
detected_id = wake_words[0].id
detected_name = wake_words[0].name
async for chunk, timestamp in stream:
if chunk.startswith(b"wake word"):
return wake_word.DetectionResult(
wake_word_id=detected_id,
wake_word_phrase=detected_name,
timestamp=timestamp,
queued_audio=[(b"queued audio", 0)],
)
@ -240,6 +243,7 @@ class MockWakeWordEntity2(wake_word.WakeWordDetectionEntity):
if chunk.startswith(b"wake word"):
return wake_word.DetectionResult(
wake_word_id=wake_words[0].id,
wake_word_phrase=wake_words[0].name,
timestamp=timestamp,
queued_audio=[(b"queued audio", 0)],
)