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

+5 -3
View File
@@ -2,7 +2,7 @@
services:
# Fix permissions for wakeword_data and configuration volume
fix-permissions:
image: "ghcr.io/ohf-voice/linux-voice-assistant:latest"
image: "ghcr.io/ohf-voice/linux-voice-assistant-pr:207"
entrypoint: []
command: "chown -R ${LVA_USER_ID:-1000}:${LVA_USER_GROUP:-1000} /app/local /app/configuration /app/wakewords/custom /app/sounds/custom"
environment:
@@ -24,7 +24,7 @@ services:
# Linux Voice Assistant
linux-voice-assistant:
container_name: linux-voice-assistant
image: "ghcr.io/ohf-voice/linux-voice-assistant:latest"
image: "ghcr.io/ohf-voice/linux-voice-assistant-pr:207"
restart: unless-stopped
network_mode: "host"
user: "${LVA_USER_ID:-1000}:${LVA_USER_GROUP:-1000}"
@@ -66,7 +66,9 @@ services:
timeout: 5s
retries: 3
start_period: 90s
#command:
command:
- "--mic-noise-suppression"
- "1"
# - --additional-parameters-here
# - --but-use-env-if-possible