hass-core/homeassistant/components/wake_word/models.py
Michael Hansen f6622ea8e0
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>
2024-02-26 20:35:19 -05:00

33 lines
730 B
Python

"""Wake word models."""
from dataclasses import dataclass
@dataclass(frozen=True)
class WakeWord:
"""Wake word model."""
id: str
"""Id of wake word model"""
name: str
"""Name of wake word model"""
phrase: str | None = None
"""Wake word phrase used to trigger model"""
@dataclass
class DetectionResult:
"""Result of wake word detection."""
wake_word_id: str
"""Id of detected wake word"""
wake_word_phrase: str
"""Normalized phrase for the detected wake word"""
timestamp: int | None
"""Timestamp of audio chunk with detected wake word"""
queued_audio: list[tuple[bytes, int]] | None = None
"""Audio chunks that were queued when wake word was detected."""