Skip to content

About

Voice satellite for Home Assistant using the ESPHome protocol

Topics

Resources

Contributing

Stars

757 stars

Watchers

10 watching

Forks

Latest commit

 

History

471 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Linux-Voice-Assistant

CI GitHub Package Version GitHub License GitHub last commit GitHub Container Registry

An experimental voice satellite software for Home Assistant remote voice control and interaction.

This project enables you to build a Linux-based voice assistant designed to use Assist for Home Assistant. It allows you to create your own smart speaker that runs on any x64 or ARM64 hardware capable of handling local audio processing (using PulseAudio).

Unlike simpler voice satellites that run on microcontrollers with very limited compute power, this setup can perform local wake word detection (OWW/MWW) and process some data on-device.

Because it runs on a full Linux system and offers access significantly more local computing resources for additional features and other integrations on the same satellite, this approach also provides greater flexibility for customization (such as for example experiment with using PipeWire).

News about this software: Discussion #495.

Linux-Voice-Assistant

A project from the Open Home Foundation

Features

  • Home Assistant
    • Connects via the ESPHome protocol (aioesphomeapi), discovered automatically via mDNS (can be turned off with --enable-zeroconf 0)
    • Optional API encryption, like ESPHome devices with an encryption key
    • Several Home Assistant clients at once, and several instances on one system (--mac-address)
    • Announcements, start/continue conversation and timers
    • Own media player entity, also for announce: true
  • Wake word and stop word
    • Local wake word detection with OpenWakeWord or MicroWakeWord
    • Two wake words or languages active at the same time (two slots, selectable in Home Assistant)
    • Stop word independent of Home Assistant, only active during TTS, announcements and a ringing timer
    • Sensitivity of both wake words and the stop word adjustable at runtime
  • Audio
    • Separate players for music (own output device with --music-output-device) and voice
    • Music is ducked or paused while the assistant talks (--mpv-player-duck-mode)
    • Mic volume, gain and noise suppression (WebRTC), adjustable at runtime
  • Peripherals
    • WebSocket API for buttons, LEDs and other hardware (API versions 1 and 2)
    • Single, double, triple and long press events are sent to Home Assistant, double, triple and long press with their own sounds
    • Button lock switch, LED light entity and remote mute (--enable-remote-unmute)
    • Software mute: with --enable-remote-unmute 0, only a peripheral (e.g. a physical mute switch) can unmute the microphone, Home Assistant cannot (see Mute). This is independent of a hardware mute of the microphone.
  • Runtime
    • Settings and states are stored locally and restored on startup
    • Docker images for linux/amd64, linux/aarch64 and linux/arm/v7 on the GitHub Container Registry, built automatically with artifact attestation
    • Tested with Python 3.11 and 3.13

Note

Second wake word verification (Home Assistant checks the wake word again on the audio before it) is not supported yet. It is being worked on in #549.

Requirements

  • Microphone: Device must support 16kHz mono audio
  • CPU: 1Ghz
  • Memory: min. 512MB
  • Storage: The OS and software is around 4GB
  • OS: linux/amd64, linux/aarch64 or 32-bit ARM linux/arm/v7

A more extensive list for possible compatible hardware can be found in the PiCompose documentation but basically any microphone that works with PipeWire (multimedia framework for Linux) can in theory be used for voice input with the prebuild image from there, you should however preferably use a far-field microphone-array solution if want better result.

Two solutions recommended for setups today is:

  • use a Raspberry Pi Zero 2W (Single Board Computer with built-in WiFi) in combination with the Satellite1 Hat Board
  • use at least a Raspberry Pi 3 with the Respeaker Lite. The Respeaker Lite currently has a problem with the Zero 2W.

Those mic-boards have microphone-array designed for far-field voice capture with the added benefit of using an onboard XMOS DSP microcontroller with custom firmware which does advanced audio pre-processing for microphone cleanup that result in very good voice recognition capabilities (as it runs algorithms for Noise Suppression, Acoustic Echo Cancellation, Interference Cancellation, and Automatic Gain Control).

Alternatively if on a lower budget then suggest could use other microphone-array boards like for example the reSpeaker 2-Mics Pi HAT V2.0 (which uses a much more basic audio codec chip).

Usage

Installation

Pick the setup that fits your system:

HomeAssistant OS Raspberry Pi image Docker / systemd
How Install the Assist Satellite app on your HomeAssistant. Flash the PiCompose image, set Wi-Fi, power on. Everything is set up, and updated automatically. Install on your own: install the audio service, then install the application with Docker Compose or on bare metal with systemd.
Includes Linux-Voice-Assistant Linux-Voice-Assistant, Music Assistant Local-Audio, Snapcast, Bluetooth proxy Linux Voice Assistant
Start Add repository
Show app
PiCompose Docker Compose
systemd

Configuration and Parameters

All command line parameters, their defaults and the matching environment variables are listed in the Parameter overview, and the controlled entities on the Home Assistant device page are explained in the Dashboard and its entities.

Feature Guides

Setup guides for individual features are in features: echo cancellation, listening during the wake sound, API encryption, own sound files, wake words (including custom wake words) and the stop word. Running LVA together with the Music Assistant Local Audio (Sendspin) player is described in docs/docker.

Debugging

If the audio does not work, see the debugging guide for how the Linux audio stack and the container sockets fit together.

Behavior

How the assistant behaves in everyday situations (music ducking during conversations, announcements, timers, stop word, mute, volume) is described in the behavior guide.

Build Information

Show build information

Image builds can be tracked in this repository's Actions tab, and utilize artifact attestation to certify provenance.

The Docker images are built using GitHub Actions, which provides:

  • Automated builds for different architectures
  • Artifact attestation for build provenance verification
  • Regular updates and maintenance

The documentation for the build process can be found in the GitHub Actions Workflows file.

Development

Docker Compose files
  • docker-compose.yml is for operation, and for checking a built image as it is (a release, nightly or the image of a pull request).
  • docker-compose.dev.yml is for checking the local state of your checkout: it mounts the source code, sounds, internal wake words, scripts and the entrypoint into the image and installs the dependencies of the local pyproject.toml. It runs the image of a pull request by default, so set LVA_IMAGE_TAG to the pull request number in .env, or use LVA_IMAGE="ghcr.io/ohf-voice/linux-voice-assistant" with LVA_IMAGE_TAG="nightly".
docker compose -f docker-compose.dev.yml up -d
System Requirements

System packages (Linux):

  • libmpv-dev (sudo apt install libmpv-dev)
  • PulseAudio/PipeWire (sudo apt install pulseaudio pipewire)
  • ALSA utils (sudo apt install alsa-utils)

Python:

  • Python 3.11+ must be installed on your system (python3 --version should show 3.11+)
  • On Ubuntu/Debian: sudo apt install python3.11 python3.11-venv python3.11-dev
VS Code Setup

VS Code development uses a local Python virtual environment (.venv/):

  1. Open workspace in VS Code
  2. Accept Workspace Trust (bottom-left status bar)
  3. Install recommended extensions when prompted:
    • ms-python.python - Python language support
    • ms-python.vscode-pylance - Python language server
    • kilo.kilocode - Kilo AI assistant
  4. Terminal → New Terminal (or Ctrl+`) - Opens integrated terminal (uses .venv when available)
  5. Run ./script/setup --dev to create .venv and install dev dependencies
  6. VS Code automatically detects .venv/bin/python as the Python interpreter

Available VS Code Tasks:

  • Ctrl+Shift+B - Run Setup or Linter
  • Ctrl+Shift+T - Run Tests
  • Ctrl+Shift+P → "Tasks: Run Task" - Show all tasks (Setup, Linter, Tests, Run App, Docker dev: up, Docker dev: down)
    • "Docker dev: down (remove orphans and volumes)" runs docker compose -f docker-compose.dev.yml down --remove-orphans -v and deletes the volumes of the dev project
    • "Docker dev: up" runs docker compose -f docker-compose.dev.yml up
Code Quality Checks

The project uses the following tools to ensure code quality:

  • Black: Code formatting (200 characters per line)
  • isort: Import sorting compatible with Black
  • flake8: Style and syntax checks
  • pylint: Code quality checks
  • mypy: Static type analysis

Docstrings are mandatory in Sphinx style with :param: (and :raises: where relevant). Google-style (Args:) and bullet-style docstrings are not accepted:

def my_function(param1: str, param2: int) -> str:
    """
    Brief one-line description of the function.
    :param param1: Description of what param1 is used for.
    :param param2: Description of what param2 is used for.
    """
Setup

To use the development tools (linting, testing, etc.), you need to install the required dependencies:

./script/setup --dev
source .venv/bin/activate
Linting Commands

Run all linting checks

./script/lint...

Individual linting commands (with auto-fix support)

Script Description Auto-fix Available?
./script/lint_black Checks Python code formatting with Black Yes, use--auto flag
./script/lint_flake8 Runs style and syntax checks with flake8 No
./script/lint_isort Checks import sorting with isort Yes, use--auto flag
./script/lint_mypy Runs static type analysis with mypy No
./script/lint_pylint Runs code quality checks with pylint Yes, use--auto flag

Examples

Run a specific lint check:

./script/lint_black

Auto-fix formatting issues (Black + isort):

./script/lint_black --auto
./script/lint_isort --auto
Testing

Run the test suite:

./script/tests
Developer documentation

How LVA communicates with Home Assistant and peripherals, and what happens during a voice request, is described in the communication overview.

License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details.

About

Voice satellite for Home Assistant using the ESPHome protocol

Topics

Resources

Contributing

Stars

757 stars

Watchers

10 watching

Forks

Releases

Packages

Contributors

Languages