GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - witold-gren/home-assistant-assist-router: Home Assistant conversation agent: answers everyday questions from your own HA data with local LLMs (Ollama), controls devices, knows who is asking. Polish first.

BranchesTags
Open more actions menu

Latest commit

 

History

18 Commits
18 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
custom_components/assist_router
custom_components/assist_router
 
 
dev
dev
 
 
docs
docs
 
 
scripts
scripts
 
 
tests
tests
 
 
tools
tools
 
 
.dockerignore
.dockerignore
 
 
.gitignore
.gitignore
 
 
CHANGELOG.md
CHANGELOG.md
 
 
GUIDE.md
GUIDE.md
 
 
LICENSE
LICENSE
 
 
Makefile
Makefile
 
 
PRZEWODNIK.md
PRZEWODNIK.md
 
 
README.md
README.md
 
 
README.pl.md
README.pl.md
 
 
hacs.json
hacs.json
 
 
mkdocs.yml
mkdocs.yml
 
 
pyproject.toml
pyproject.toml
 
 
requirements_docs.txt
requirements_docs.txt
 
 
requirements_test.txt
requirements_test.txt
 
 
router.example.pl.yaml
router.example.pl.yaml
 
 
router.example.yaml
router.example.yaml
 
 

Repository files navigation

Assist Router

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.

The Assist Router editor: the tree of router.yaml, the form of a topic and the tester

Try it on a Mac

  • 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.yaml in 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-clean removes the image.
  • Docs and developers: make docs builds this documentation in Docker and opens it. make test and make test-browser need make setup (uv, which fetches Python 3.14 itself; Chrome for the browser tests); make demo-local serves the same page without Docker.

What it does

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.

Installation

  1. Copy custom_components/assist_router to /config/custom_components/ (or HACS: custom repository, type “Integration”) and restart HA.
  2. Settings → Devices & services → Add integration → Assist Router.
  3. Copy router.example.yaml to /config/assist/router.yaml and 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.
  4. In the integration options, enter the Ollama URL and choose the models.
  5. 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.

Services in docker compose (without HA add-ons)

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
  1. 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).
  2. 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).
  3. In the Assist Router options, set the Ollama URL: http://192.168.1.10:11434.
  4. 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-whisper image 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 (variables WHISPER_MODEL, WHISPER_LANG).
  • Jetson: use runtime: nvidia instead of the deploy section. The official ollama/ollama image detects the Orin GPU on its own. Whisper and Piper on the Jetson GPU need images built for JetPack (e.g. from the dusty-nv/jetson-containers project).
  • 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.10 is an example address of the computer running the containers. Expose the ports only on your home network.

Ollama alone in docker compose

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 deploy and add runtime: nvidia. The official ollama/ollama image 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 deploy and choose a small model, e.g. gemma4:e4b.
  • AMD card: the ollama/ollama:rocm image with the /dev/kfd and /dev/dri devices.

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.

Documentation

  • GUIDE.md: the whole setup step by step, for beginners (Polish version: PRZEWODNIK.md);
  • full documentation with diagrams: how the router works, router.yaml fields, 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.

Training your own model

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.

Development

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).

Adding a language

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 with matches / not_matches examples 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.

About

Home Assistant conversation agent: answers everyday questions from your own HA data with local LLMs (Ollama), controls devices, knows who is asking. Polish first.

witold-gren.github.io/home-assistant-assist-router/

Topics

assisthacshome-assistantllmollamapolishvoice-assistantwyoming

Resources

Readme
Apache-2.0 license
Activity

Stars

1 star

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.