Wake word sensitivity (#207)

## Summary
- Introduces configurable wake word and stop word sensitivity
- Adds UI-controllable thresholds for wake word detection
- Refactors wake word loading and handling logic
- Improves audio preprocessing and runtime behavior

## Key Features
- Per-wake-word sensitivity configuration (Wake Word 1 & 2)
- Configurable stop word sensitivity
- Fine-grained numeric control (0.0 – 1.0, step 0.001)
- Sensitivity values exposed as Number Entities for Home Assistant
- Persistent storage of user-defined sensitivity values

## Wake Word Handling
- Support for model-specific default thresholds (`probability_cutoff`)
- Automatic fallback to defaults if no user value is set
- Separate thresholds for:
  - Wake Word 1
  - Wake Word 2
  - Stop Word
- Unified handling for MicroWakeWord and OpenWakeWord models

## UI / API Integration
- Adds new Home Assistant entities:
  - `WakeWord1SensitivityNumberEntity`
  - `WakeWord2SensitivityNumberEntity`
  - `StopWordSensitivityNumberEntity`
- Entities support:
  - Live updates
  - Persistence via preferences
  - Synchronization with runtime state
- Pushes updated values to Home Assistant on startup

## Refactoring
- Extracted wake word logic into `wake_word.py`
  - Model discovery
  - Model loading
  - Stop word handling
- Simplified `__main__.py` by delegating wake word responsibilities
- Improved separation between configuration and runtime state

## Additional Changes
- Improved debug logging across initialization and runtime

## Impact
- Enables fine-tuning of wake word detection accuracy
- Reduces false positives and missed triggers
- Improves usability via UI-based configuration
- Provides better flexibility across different environments and microphones
This commit is contained in:
Omar Amin authored and GitHub committed 2026-04-21 02:04:11 +02:00
1 parent 0de631160e
commit 3ea32895ee
14 files changed
+793 -115

No files matched your search

+4 -1
View File
@@ -1,5 +1,8 @@
{
"type": "openWakeWord",
"wake_word": "Alexa",
"model": "alexa_v0.1.tflite"
"model": "alexa_v0.1.tflite",
"openWakeWord": {
"probability_cutoff": 0.7
}
}
+4 -1
View File
@@ -1,5 +1,8 @@
{
"type": "openWakeWord",
"wake_word": "Hey Jarvis",
"model": "hey_jarvis_v0.1.tflite"
"model": "hey_jarvis_v0.1.tflite",
"openWakeWord": {
"probability_cutoff": 0.7
}
}
+4 -1
View File
@@ -1,5 +1,8 @@
{
"type": "openWakeWord",
"wake_word": "Hey Mycroft",
"model": "hey_mycroft_v0.1.tflite"
"model": "hey_mycroft_v0.1.tflite",
"openWakeWord": {
"probability_cutoff": 0.7
}
}
+4 -1
View File
@@ -1,5 +1,8 @@
{
"type": "openWakeWord",
"wake_word": "Hey Rhasspy",
"model": "hey_rhasspy_v0.1.tflite"
"model": "hey_rhasspy_v0.1.tflite",
"openWakeWord": {
"probability_cutoff": 0.7
}
}
+5 -2
View File
@@ -1,5 +1,8 @@
{
"type": "openWakeWord",
"wake_word": "Okay Nabu",
"model": "ok_nabu_v0.1.tflite"
"wake_word": "Ok Nabu",
"model": "ok_nabu_v0.1.tflite",
"openWakeWord": {
"probability_cutoff": 0.7
}
}