English · Polski
A conversation agent for Home Assistant (domain assist_router, entity
conversation.assist_router) that makes Assist understand ordinary questions and commands,
not just memorized sentences.
Language: everything language-dependent (keywords, built-in phrases, prompts, spoken replies) lives in a language pack. The bundled pack is Polish, so the assistant understands and answers Polish today; more packs can be added - see Adding a language. The example sentences below are in English for readability; with the Polish pack you say them in Polish.
Building a new voice setup from scratch (satellites, Whisper, Piper, Ollama, speaker recognition)? Start with GUIDE.md (Polish version: PRZEWODNIK.md).
Edit router.yaml in the editor. From 0.1.6 the Assist Router editor panel (administrators) edits the
router's file on a computer: forms or YAML for each topic with its comments kept, a draft, a tester of sentences, a
test set and a history of saves, so there is no need to edit the YAML file by hand. Step by step:
the editor guide.
- Needs: only Docker Desktop, running. No Python, no Home Assistant, no Ollama, no GPU.
- Run:
make demo(the first build of the small image takes under a minute). - Open: http://127.0.0.1:8767/dev/editor-demo.html (English: add
?lang=en), no login. - Made up: the example
router.example.pl.yamlin a made-up home, in a container; nothing is saved and nothing reaches a real Home Assistant. Ctrl+C stops and removes the container,make demo-cleanremoves the image. - Docs and developers:
make docsbuilds this documentation in Docker and opens it.make testandmake test-browserneedmake setup(uv, which fetches Python 3.14 itself; Chrome for the browser tests);make demo-localserves the same page without Docker.
Every sentence goes to the built-in HA agent first. Intents, custom_sentences
and sentence-triggered automations keep working unchanged. When HA does not recognize a sentence:
| What | How |
|---|---|
| Question router | A model in Ollama picks a topic from /config/assist/router.yaml (calendar, school lessons, weather, sensors…). The code collects the topic's data from entities, attributes and services, trimmed to the person and day from the question. The answer model replies briefly from that data. |
| Control | Turns “Turn off the lamp in the walk-in closet”, “make it warmer”, “play jazz in the living room” into HA intents. When unsure, or for sensitive devices, it asks “Do I understand correctly…?”. |
| Knowledge | General questions (“Who was Copernicus?”) are answered with a Wikipedia summary. |
| Who is asking | With the Assist Speaker ID integration, a first-person question (“What do I have tomorrow?”) is about the speaker. Family terms (“my brother”), the speaker's room (“in my room”) and the question “Who is speaking?” work too. |
| Announcements (intercom) | “Announcement, kids, please come to dinner” plays your recording on the other speakers instead of synthesized speech (Assist Speaker ID). |
| Gibberish | A misrecognized sentence ends with the question “Did you mean …?”. After two misunderstandings in a row Assist apologizes and ends the conversation. |
| Several commands | „Zamknij rolety w salonie i włącz ekspres do kawy” (close the blinds and start the coffee machine) – the model splits the sentence into complete commands, each takes the usual path; one needing a question waits, the rest follow after the answer. |
| Corrections | To any question from the assistant you can answer “no” and the command again („nie, wyłącz światło w łazience”) – it is handled from the start, as many times as needed. |
| Fallback agent | When the router has no data, the chosen LLM agent takes over the question. |
| Log | Unrecognized sentences go to /config/assist/unrecognized_commands.csv, with a preview in the options, a sensor and a clear action. |
| Example commands | The assist_router.generate_examples action writes sentences from your entities and checks them with the real router. The result lands in assist/router_examples.yaml. |
| Editor on a computer | The Assist Router editor panel (administrators): the tree of router.yaml, the YAML of one topic with its comments (every other line stays as it was), a draft, the router's check, saving with a .bak copy and a history of 30 versions. Also integration options → “Router file”. Step by step with pictures: the editor guide. |
Proven in practice: the author runs everything daily on an NVIDIA Jetson AGX Orin 64 GB (Ollama with Gemma 4 26B, faster-whisper, Assist Speaker ID) and it works very well: the router answers in about 0.7 s, an answer from data (router plus answer model) takes about 2 s.
- Copy
custom_components/assist_routerto/config/custom_components/(or HACS: custom repository, type “Integration”) and restart HA. - Settings → Devices & services → Add integration → Assist Router.
- Copy router.example.yaml to
/config/assist/router.yamland adjust the entities and people. For a Polish household (the bundled language pack) start from router.example.pl.yaml: the same file with Polish descriptions and examples. - In the integration options, enter the Ollama URL and choose the models.
- Settings → Voice assistants: in every pipeline set the conversation agent to “Assist Router” and turn off “Prefer handling commands locally”. Otherwise the built-in HA intents get ahead of announcements, “Who is speaking?” and voiceprint enrollment.
Assist Router is an HA integration. The services it uses (Whisper, Piper, Ollama
and optionally Assist Speaker ID)
do not have to be add-ons. They can run as containers on another computer, e.g. one with a
graphics card. That is how the author runs them, on a Jetson AGX Orin 64 GB. An example
docker-compose.yaml:
services: whisper: # speech to text (Wyoming, port 10300) image: rhasspy/wyoming-whisper command: --model medium-int8 --language pl # the language of your household ports: ["10300:10300"] volumes: ["./whisper:/data"] restart: unless-stopped piper: # text to speech (Wyoming, port 10200) image: rhasspy/wyoming-piper command: --voice pl_PL-gosia-medium # a voice in your language ports: ["10200:10200"] volumes: ["./piper:/data"] restart: unless-stopped ollama: # language models for the router and answers (port 11434) image: ollama/ollama ports: ["11434:11434"] volumes: ["./ollama:/root/.ollama"] environment: OLLAMA_FLASH_ATTENTION: "1" OLLAMA_MAX_LOADED_MODELS: "2" restart: unless-stopped deploy: # NVIDIA card (requires NVIDIA Container Toolkit) resources: reservations: devices: [{ driver: nvidia, count: all, capabilities: [gpu] }] speaker-id: # optional: who is speaking (in front of Whisper, ports 10350/10351) build: ./home-assistant-assist-speaker-id/speaker_id # git clone next to this file depends_on: [whisper] ports: ["10350:10350", "10351:10351"] volumes: ["./speaker-id:/data"] environment: SPEAKER_ID_UPSTREAM: tcp://whisper:10300 SPEAKER_ID_API_TOKEN: ${SPEAKER_ID_API_TOKEN} # from the .env file next to it restart: unless-stopped
- Start it:
docker compose up -d, then pull a model:docker compose exec ollama ollama pull gemma4:26b(or a smaller one, e.g.gemma4:e4b). - In HA: Settings → Devices & services → Add → Wyoming Protocol for Piper
(
192.168.1.10, port 10200) and Whisper (port 10300). With Assist Speaker ID, add the Assist Speaker ID integration instead of Whisper (ports 10350 and 10351, token from.env). - In the Assist Router options, set the Ollama URL:
http://192.168.1.10:11434. - In the voice assistant: speech to text Whisper (or “Speech to text with speaker”), agent Assist Router, text to speech Piper.
Notes:
- Whisper: the
rhasspy/wyoming-whisperimage computes on the CPU. On a graphics card (e.g.large-v3) use an image with CUDA, e.g.lscr.io/linuxserver/faster-whisper:gpu(variablesWHISPER_MODEL,WHISPER_LANG). - Jetson: use
runtime: nvidiainstead of thedeploysection. The officialollama/ollamaimage detects the Orin GPU on its own. Whisper and Piper on the Jetson GPU need images built for JetPack (e.g. from thedusty-nv/jetson-containersproject). - Without a GPU: Ollama also runs on the CPU, but then choose a small model (e.g.
gemma4:e4b) and expect slower answers. - Service address:
192.168.1.10is an example address of the computer running the containers. Expose the ports only on your home network.
When Whisper and Piper already run as HA add-ons, Ollama alone on a computer with a graphics card is enough:
services: ollama: image: ollama/ollama container_name: ollama command: serve ports: ["11434:11434"] volumes: ["./ollama:/root/.ollama"] # downloaded models (a dozen or more GB) environment: OLLAMA_HOST: 0.0.0.0 OLLAMA_KEEP_ALIVE: "72h" # the model stays in memory, no loading on a question OLLAMA_NUM_PARALLEL: "1" OLLAMA_MAX_LOADED_MODELS: "2" # router and answer model at once, if they differ OLLAMA_FLASH_ATTENTION: "1" OLLAMA_KV_CACHE_TYPE: "q8_0" # less context memory restart: unless-stopped deploy: # NVIDIA card (NVIDIA Container Toolkit) resources: reservations: devices: [{ driver: nvidia, count: all, capabilities: [gpu] }]
- Jetson (JetPack 6): remove
deployand addruntime: nvidia. The officialollama/ollamaimage has an arm64 build and detects the Orin GPU on its own; that is how the author runs it on an AGX Orin 64 GB. - Without a GPU: remove
deployand choose a small model, e.g.gemma4:e4b. - AMD card: the
ollama/ollama:rocmimage with the/dev/kfdand/dev/dridevices.
Start-up and models:
docker compose up -d ollama docker compose exec ollama ollama pull gemma4:26b # router and answers (18 GB, 24 GB card) docker compose exec ollama ollama pull gemma4:e4b # smaller (about 8 GB): router or a lighter setup curl http://192.168.1.10:11434/api/tags # from the HA computer: list of models
In the Assist Router options, enter http://192.168.1.10:11434 and choose the models from
the list. The “Keep model in memory” option (-1 = always) means only the first question
after Ollama starts waits for the model to load.
- GUIDE.md: the whole setup step by step, for beginners (Polish version: PRZEWODNIK.md);
- full documentation with diagrams: how the router works,
router.yamlfields, data sources, control, speaker, log, model tests, privacy. In English: docs/en, in Polish: docs/pl (source files: docs/); - LLM model comparison (the test used Polish questions): Gemma 4, Bielik, PLLuM, Qwen 3.5, Ministral on a Jetson AGX Orin 64 GB, accuracy and time in each role;
- router.example.yaml: an example configuration with comments (a fictional household: Tom, Anna, Olivia, Jack); the Polish version: router.example.pl.yaml;
- CHANGELOG.md: changes in each version.
The trainer home-assistant-assist-router-trainer
fine-tunes a smaller model (Gemma 4 E2B / E4B) on your home for the router, the control and the
answers, to run in Ollama next to Home Assistant. It reads its data through the read-only command
assist_router/training/export (an administrator's long-lived token): router.yaml, the log of
unrecognized commands, the test files, the automations with a conversation trigger and
custom_sentences. With assist_pipeline: debug_recording_dir set, two more read-only commands,
assist_router/training/recordings and assist_router/training/recording_files, hand over the
speech-to-text recordings of the voice commands (the list, then the files in parts), so the
trainer learns from the home's real speech. Nothing in Home Assistant is changed.
make help # every target, in English or Polish (HELP_LANG=en|pl) make test # tests of the integration (the environment is made by the first target) make test-browser # tests of the editor in Google Chrome make demo # the editor on router.example.pl.yaml in the browser, nothing saved (Docker, port 8767) make deploy # copies the integration to HA's config share (custom_components)
The version lives in manifest.json, CHANGELOG.md describes the changes, and a release is a
vX.Y.Z tag. Tools for testing models and sentences are in tools/ (model_benchmark.py,
check_sentences.py, compare_sources.py, snapshot_data.py; description: documentation,
chapter 12).
The integration ships the Polish language pack. Everything language-dependent is one folder,
custom_components/assist_router/languages/<code>/, mostly plain YAML a translator can edit
without Python:
texts.yaml- what the assistant says, log lines, the prompts and their JSON key words;words.yaml- words it understands (yes / no, verbs, colours, days, family words …);patterns.yaml- regular expressions, each withmatches/not_matchesexamples the tests check;grammar.py- the few functions that build sentences (plural forms, cases, dates).
To add e.g. Czech: copy languages/pl/ to languages/cs/ (or let the trainer write a checked
machine translation: router-trainer language new cs), translate, and run
tools/check_language.py custom_components/assist_router/languages/cs - one line per problem
(a lost {field}, a translated Home Assistant name, a pattern that no longer finds its example).
The pack is used when HA's language is cs or router.yaml has language: cs.
Details: Adding a language. Contributions are welcome as a pull request.
