* Add --music-output-device to route music separately from voice
Music/media and TTS both play through --audio-output-device today, with no
way to send them to different sinks. Add an optional --music-output-device
(env MUSIC_OUTPUT_DEVICE) that the music player uses instead, defaulting to
--audio-output-device so existing setups are unchanged. Wired through
docker-entrypoint.sh and documented in the README and install docs.
* docs: fix swapped Default/Description columns in env var table
The MIC_VOLUME, MIC_AUTO_GAIN, MIC_NOISE_SUPPRESSION and
AUDIO_INPUT_CHANNELS rows had their Default and Description columns
swapped relative to the table header; fix the ordering and the
'Suppresion' misspelling. Also repair the UNMUTE_SOUND row, whose
description was garbled and which was missing its closing table pipe.
---------
Co-authored-by: Matthew Davis <fedoraproject@virtual.drop.net>
Co-authored-by: Florian Asche <github@florian-asche.de>
Co-authored-by: Omar Amin <65174210+omaramin-2000@users.noreply.github.com>
This PR adds the ability to select microWakeWord/openWakeWord models using the wake word dropdown selection via the HA device page at any time without the need for restarting the app/container to change the wake word path.
* Add type ignore for stop_word attribute assignment
Added type ignore comment for stop_word attribute.
* Refactor exception handling in disconnect process
Updated exception handling to use pylint directive for broad exceptions.
* Fix callback lambda for broadcasting state
The ESPHome API server delivered asynchronous entity-state changes to a single
connection (the entity's `server`), which every new connection reassigns. A
second API client — a diagnostic tool, a second dashboard, or Home Assistant's
own overlapping reconnect — therefore stole state delivery, leaving Home
Assistant stuck on a stale state (e.g. `media_player` showing `playing` after
playback had finished). `connection_lost` also stopped the shared music/TTS
players for *any* dropped connection.
- models.py: add a per-server connection registry and a `broadcast()` helper.
- satellite.py: register/deregister connections in connection_made/_lost; only
stop shared playback when the last client disconnects; handle the standard
`SubscribeStatesRequest` by replaying current entity state to the subscriber.
- entity.py: push playback-completion state via broadcast to all clients.
Co-authored-by: Omar Amin <65174210+omaramin-2000@users.noreply.github.com>
Co-authored-by: Florian Asche <github@florian-asche.de>
* Update libmpv initialization to use demuxer_max_bytes and cache_secs
instead of the deprecated cache-size property. This ensures more
predictable memory usage and better buffering behavior during
playback.
Use events and commands to control custom onboard leds and buttons. Can be used to communicate with an external Python script via a WebSocket API running in a container alongside LVA.
Add a configurable amount of delay (defaulting to 0.5s) after the TTS playback is finished to avoid the mic to capture the end of response during start/continue conversation.
Fixes#313
## 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
## WebRTC Auto Gain & Noise Suppression
This PR adds support for WebRTC Auto Gain and Noise Suppression as previously implemented in the Wyoming Satellite project.
### What's New
Two new entities have been created a number slider for gain and another one for noise suppression. The processing happens inside of the `webrtc.py` file and is implemented in the `__main__.py` file's `process_audio` function. The slider for gain has a limit of 0-31 and noise suppression has a limit of 0-4.
The Auto Gain and Noise Suppression persist through restarts and are saved as preferences. The values are dynamically chnged without needing a restart.
CLI flags called `--mic-auto-gain` and `--mic-noise-suppression` have also been added.
> When both values are 0, WebRTC processing is bypassed entirely with no performance overhead.
Closes#25
### Testing
When saving the audio recorded by LVA there is a noticeable increase. The following two files have been recorded with similar audio being played through them with these results (Gain-31 and NS-4):
| Metric | With AGC+NS | Without |
|---|---|---|
| Max amplitude | 0.329 | 0.054 |
| RMS amplitude | 0.008905 | 0.002862 |
| Volume adjustment needed | 3.034x | 13.479x |
| Rough frequency | 916 Hz | 705 Hz |
Introduce a new `--output-only` command-line flag and corresponding `ENABLE_OUTPUT_ONLY` environment variable. This allows users to run the assistant in output-only mode, where it only supports announcements. The change includes updates to configuration examples, documentation, and the Docker entrypoint script.
Output only satellite for nodes with only speakers and no microphone.
Supports announcements and playing media only.
---------
Co-authored-by: Florian Asche <github@florian-asche.de>
Wake-up after stopping ringing timer using wake words such as "Okay Nabu", "Hey Jarvis" rather than "Stop" to get another command instead of the need to repeat the wake word.
Auto stop ringing timer if the determined time (default 15 mins) has passed without manually stopping. This max time can be modified using the command `--timer-max-ring-seconds`.
tts_player.stop() already invokes its done_callback which is
_tts_finished(), so the explicit self._tts_finished() call immediately
after was a duplicate. This caused double 'Unducking music' and double
'TTS response finished' log entries on every stop-word-triggered stop.
Also move _pipeline_active = False inside the 'if not self._tts_played'
branch in VOICE_ASSISTANT_RUN_END, so it is not cleared while TTS is
still playing.
Co-authored-by: Omar Amin <65174210+omaramin-2000@users.noreply.github.com>
* moved port check from shell script into the python application
* fixed pulseaudio check console output
* portcheck has now 15 chances to get the port before abort
* bugfix: supress first end of file event and only callback on second one
* add some notes on testing
* fixed tts.speak
* fix unduck after timer end
* use custom docker-entrypoint on dev container
* change mv to copy in the docs when using .env file
Check if player is actually playing before calling stop(for_replacement=True)
in MpvMediaPlayer.play(). When the player was already idle,
stop(for_replacement=True) would set _suppress_end_event=True with no
end-file event to consume it. The next track's end-file callback would
then be incorrectly suppressed, breaking the timer loop.
- Import PlayerState to check player state
- Only call stop(for_replacement=True) when player is not IDLE
* Change Client-Name: The client name inside LVA is not capable of having spaces in the name. Fixed the example.
* Add first version of Docker-Compose for developers
* Add variable for network-interface and auto detection by default
* Added autodetection for the MAC-Address based on the detected or specified network-interface.
* Switched from listening on all IP-Addresses to the IP of the default interface, usually u set the correct network-interface and it will automatically detect the right IP-Address.
* Added missing variables, fixed variables names
* Fixed not working variables for example sound-files.
* Moved the auto-name creation from shell to python. The name is no longer mandatory, it will be generated if no name is given.