“Turn off the main light” is transcribed without a single error, yet the bedroom light switches off instead of the living room. “Get ready for bed” works with one phrasing and fails with another. Then the television says something that sounds like a command, raising an uncomfortable question about what the house might actually obey. These are failures in different layers—swapping in a larger local model will not fix them together.
Reliable local AI voice control separates four jobs: audio capture, transcription, room-and-entity resolution, and execution authority. Keep predictable commands on deterministic paths, let a local LLM interpret open phrasing where helpful, and enforce allowed targets, parameter bounds, and persistent-rule changes strictly outside the model.
Throughout this guide we use an illustrative household: a main light in both the living room and bedroom, an ESP32 voice satellite in the living room, Home Assistant for entities and scripts, a local Chinese ASR service, and an optional local LLM. Configurations are checked statically against Home Assistant Core 2026.10.4 and ESPHome 2026.10.2 documentation as an isolated teaching lab—no household recognition rates or latency numbers have been measured here.
Isolate the layer first: right words, wrong light
The fastest diagnostic is a same-sentence comparison: send “turn off the living-room main light” through Assist's text input first, then speak the exact same sentence into the microphone.
- Text fails too: inspect entity names, areas, exposure settings, intent matching, and the device execution chain. Tuning microphone gain here is wasted effort.
- Text succeeds, speech fails: focus on wake detection, raw audio capture, VAD endpoints, and ASR configuration.
For every failed test, correlate the transcript, resolved target, and execution outcome to the same request rather than saving a screenshot of “I didn't understand.” Pair Home Assistant's voice troubleshooting guide with automation traces to pinpoint the break:
| Symptom | Inspect first | Where to fix |
|---|---|---|
| Fails to wake, or the TV triggers false wakes | Wake events, active windows, TV phrases | Wake model, threshold, placement, or push-to-talk |
| Drops “don't” or mangles device names | Raw audio, clipped starts/ends, ASR language | Capture front end, VAD, ASR model & task |
| Transcript is exact, wrong room reacts | Satellite area, entity names, aliases, exposure | Areas, entity registry, intent matching |
| Right target, device never changes | Action trace, device link, state freshness | Integration and device control path |
| Device changes, assistant reports failure | Tool return value, state readback, TTS timeout | Result contract and feedback path |
This also shows why overall word or character error rate (WER/CER) can mislead you. Perfect transcription still fails when area matching picks the bedroom; conversely, dropping a single “don't” from “don't turn off the main light” produces the exact opposite action even when downstream rules work flawlessly. Track negations, room names, and action verbs separately in your test set so easy phrases do not hide high-impact mistakes.
Tune the local Chinese voice path in order
Protect clean speech before stacking noise suppression
Living-room capture usually suffers from mixed sources—TV audio, fans, and the satellite's own speaker—long before model size becomes the bottleneck. Lock down satellite placement, speaker distance, and orientation, then record three baselines: quiet room, TV on, and satellite speaking. Check for clipping, clipped first syllables, and truncated negations, changing one setting per iteration so every shift stays attributable.

Illustrative scene only: placement relative to a TV strongly shapes microphone SNR; not an acoustic measurement.
When playback degrades recognition, distinguish acoustic echo cancellation (AEC) from generic noise suppression. As Espressif's ESP-SR AFE documentation details, AEC requires an aligned playback reference channel; flipping an AEC flag without wired reference timing will not deliver full-duplex listening, and an external TV is never part of that reference. Likewise, ESPHome's voice_assistant parameters (noise_suppression_level, auto_gain, volume_multiplier) adjust software preprocessing rather than guaranteeing a hardware AEC chain—pushing gain amplifies room noise, while heavy suppression erases quiet voices.
VAD sets utterance boundaries: cutting too early drops slow speakers or pauses; cutting too late drags in TV dialogue and inflates latency. If your hardware cannot handle reliable barge-in yet, pause microphone capture while the satellite speaks and reopen it afterward—giving up natural interruption is far safer than letting the satellite trigger commands from its own TTS output. For deeper audio-buffer and network tuning, see ESPHome voice-satellite troubleshooting.
Pick the right engine and watch shared-host tail latency
Home Assistant's local Assist guide separates Speech-to-Phrase (constrained command sets) from Whisper (open speech). Avoid copying English speed demos straight into Chinese homes: as of November 2026, the Speech-to-Phrase migration notes (legacy Kaldi repo frozen at v1.4.3, active work moved to OHF-Voice/apps) do not list Chinese among served languages.
When evaluating Whisper for Chinese, use a multilingual checkpoint (never .en) and keep the task set to transcribe rather than translating commands into English before matching Chinese entity names. Benchmark explicit Chinese language locking against auto-detect separately on pure Mandarin versus mixed Chinese-English utterances.
Watch tail latency when ASR, TTS, and an LLM share one mini-PC: a fast solo transcription can still stall under multi-room traffic, prompting users to repeat commands and fire duplicate actions. Keep high-frequency short commands like “turn off the light” on deterministic intent matching instead of paying an LLM round trip every time. Where an ASR backend supports device-name hints or hotwords, use them as an aid—never as a substitute for clarifying missing action verbs or conflicting interpretations.
Resolving “main light” across two rooms
Assign light.living_main (“living-room main light”) and light.bedroom_main (“bedroom main light”) to their respective areas, give both the short alias “main light,” and place the living-room satellite in the living-room area. Per Home Assistant's alias documentation, area context helps resolve unqualified requests from that satellite.
Keep the boundary clear: aliases fix name-to-entity matching, not speech recognition. If ASR outputs the wrong characters, adding aliases will not repair transcription; if the transcript is right and the wrong room switches, check area assignments and duplicate names instead of retuning audio.
Area resolution breaks when a satellite moves without updating its registered area, when requests come from a phone with no room context, or when two entities in the same area share a short name. Verify fully qualified room commands before enabling unqualified shortcuts, and follow Assist device exposure by starting with a small set of low-risk entities—exposure is a control-surface allowlist, not a user permission system.
“Get ready for bed”: flexible parameters, locked execution
A bedtime routine needs configurable targets, brightness bounds, and enabling conditions—not an LLM inventing a fresh device list every night. Never expose a generic tool accepting arbitrary entity_id and service names.
Both custom sentences and an LLM tool call can invoke the same audited script, but they are separate entrances. The Ollama integration marks device control experimental and does not directly integrate sentence triggers; if you want “fixed commands first, LLM fallback on miss,” build and test that routing layer explicitly.
Rehearse with virtual states before touching real hardware
Start in an isolated test instance with virtual helpers: input_boolean.lab_living_main and input_number.lab_bedroom_level stand in for the two lights, while three policy helpers hold an allow switch, a guest restriction switch, and a 5–35 brightness target (an illustrative range, not a lighting standard).
Back up the test instance, place a complete Home Assistant package (defining those helpers, the script below, and a conversation automation matching the Chinese lab triggers 准备睡觉演练 and 执行睡前灯光演练—the English phrase “get ready for bed” is narrative only, not a configured trigger) under packages/, and merge this line into the existing homeassistant: block:
homeassistant:
packages: !include_dir_named packages
Below is the core script (preserving the Chinese labels and responses of the statically checked lab package so both versions stay identical). It accepts zero external target or action arguments and enforces every policy guard inside the executor:
script:
local_voice_bedtime_lab:
alias: 睡前灯光演练
description: 只更新两项虚拟灯光状态,不操作真实设备,不保存或修改策略
mode: single
sequence:
- variables:
level: "{{ states('input_number.local_voice_night_level') }}"
- choose:
- conditions:
- condition: template
value_template: >-
{{ is_state('input_boolean.local_voice_allow_bedtime', 'on')
and is_state('input_boolean.local_voice_guest_mode', 'off')
and is_number(level)
and 5 <= (level | float(-1)) <= 35
and states('input_boolean.lab_living_main') in ['on', 'off']
and is_number(states('input_number.lab_bedroom_level')) }}
sequence:
- action: input_boolean.turn_off
target:
entity_id: input_boolean.lab_living_main
- action: input_number.set_value
target:
entity_id: input_number.lab_bedroom_level
data:
value: "{{ level | float }}"
- variables:
result:
status: simulated
message: 已更新虚拟灯光状态,未操作真实设备
- stop: 虚拟演练步骤结束
response_variable: result
default:
- variables:
result:
status: rejected
message: 未执行演练,请检查允许开关、访客模式与实体参数状态
- stop: 策略或状态检查未通过
response_variable: result
Four guardrails matter most here:
- Fail-closed defaults. The routine starts disabled with guest restriction enabled, so the first call hits
defaultwith zero actions. Explicitis_state(..., 'off')andis_numberchecks preventunknownorunavailablestates from slipping through as permission. - Isolate policy helpers from voice. Never expose the three policy helpers to Assist, or the model could disable guest mode before calling the script. Hiding helpers in the UI does not block API writes; real per-user policy isolation requires an authenticated permission boundary.
- Wait for structured return data. The automation invokes
script.local_voice_bedtime_labdirectly to captureresponse_variablerather than firing and forgetting (see script call semantics and exposing scripts to LLMs). - Know the executor's limits.
mode: singlestops concurrent re-entry, not retried duplicates; sequential steps are not a transaction with automatic rollback; and automation conditions evaluate once at entry, so long-running or hazardous loads (heat, motors) still require repeated checks and physical safety cutoffs.
8-case policy boundary regression matrix
To verify the six guard clauses extracted directly from local_voice_policy_lab.yaml, we ran an offline deterministic matrix check (policy-matrix-test.mjs) across 8 boundary states (8/8 passed; this validates policy logic and static constraints locally, while full live loading still belongs in an isolated Home Assistant instance):
| Case | Input State Combination | Expected | Actual | Actions Fired |
|---|---|---|---|---|
| T1 | YAML defaults (allow off, guest restriction on) | rejected |
rejected |
0 |
| T2 | Allow on + guest off + brightness 15 | simulated |
simulated |
2 |
| T3 | Lower bound: brightness 5 | simulated |
simulated |
2 |
| T4 | Upper bound: brightness 35 | simulated |
simulated |
2 |
| T5 | Out of range: brightness 36 | rejected |
rejected |
0 |
| T6 | Guest switch is unavailable |
rejected |
rejected |
0 |
| T7 | Target brightness is unknown |
rejected |
rejected |
0 |
| T8 | Bedroom virtual light is unavailable |
rejected |
rejected |
0 |
Cases T6–T8 highlight why explicit state checks matter: when an integration restarts or drops into unknown or unavailable, the script fails closed with zero actions instead of treating “not on” as permission.
Validate both entrances before attaching a microphone
Keep acceptance configs separate from daily household configs. Freeze and log the Home Assistant Core version, conversation agent, ASR/TTS service versions, and script checksum—even a model-only swap should rerun default rejection, allowed execution, and unavailable-state cases so regressions map cleanly to a restorable baseline.
- Fixed sentence via text: Load the package in the isolated instance, select the native Home Assistant conversation agent, type the lab trigger, and verify traces, return payloads, and both virtual states for allowed and rejected runs.
- Ollama tool call via text: Configure a separate assistant with a tool-capable model, expose only the lab script, and inspect the actual tool list in debug tools. Test varied phrasings and verify that a
rejectedreturn is reported honestly. If the model picks the wrong tool or ignores rejection, fall back to fixed sentences instead of widening tool permissions. - Voice satellite last: Verify Chinese ASR, conversation handling, and Chinese TTS voices independently, judging success by traces and state transitions rather than a cheerful spoken “done.”
As you add rules like “evenings only” or “dim only when occupied,” place time windows and sensor-freshness checks in the execution layer with an explicit offline policy (skip, reject, or manual fallback). If you later accept a brightness argument from speech, enforce type, unit, and range checks on the backend—never rely on UI sliders or system prompts.
Separate one-off actions from persistent rule changes
“Dim the night light tonight” modifies present state; “always dim it at bedtime” changes future behavior. Letting a conversational assistant silently save inferred habits soon leaves the household wondering why devices act on their own.
Persistent edits belong in a separate change-management flow outside this lab YAML: generate a readable diff proposal (target routine, old vs. new values, affected devices, effective schedule), record a policy version, rehearse against virtual states, and require an authorized user to enable it. In early deployments, having the model explain proposed edits while an administrator applies them manually trades a bit of autonomy for full traceability.
Television, guests, and privacy: three hard boundaries
1. A microphone knows the room, not the speaker
When a TV broadcasts “unlock the door” or a guest speaks to the living-room satellite, area context proves location—not owner authorization. A wake word is not a password, and voice biometrics alone should not unlock high-risk actions.
Home Assistant's Acts as user option runs actions under a configured account without identifying who spoke. Treat shared-room microphones as low-trust entrances: keep locks, heaters, and gas valves out of voice exposure entirely, and audit every exposed compound script (such as “away mode”) along its full call chain so no child script creates a hidden path to a locked-down entity.
2. Confirmation cannot come through the same microphone
Asking “are you sure?” over the same speaker can still be answered by a TV, recording, or guest. Any sensitive action that truly needs voice initiation should route confirmation to an authenticated phone or trusted display showing exact targets and parameters, bound to a single short-lived request—replay-resistant ticket validation requires an independent authorization service, not a confirmed: true flag on a script. Until that layer exists, keep sensitive devices on trusted manual controls.
The same principle applies to prompt injection via device names or retrieved text: system prompts help, but real containment comes from locking down the toolset—never grant a home assistant general shell access, arbitrary HTTP, arbitrary service calls, or config-write privileges.
3. “Local AI” still needs network, log, and failure audits
Even when speech and inference run on your LAN, verify three operational details before calling the setup private and resilient:
- Outbound traffic and ports: Check add-ons and containers for external calls, never expose local inference ports to the internet, and separate voice-chain tokens from admin credentials.
- Minimal logging and audio consent: Keep routine logs to request IDs, result codes, timestamps, and redacted targets. If acoustic debugging requires saving recordings, get explicit household consent and enforce automatic deletion.
- Fault-by-fault degradation: Disconnect the internet, stop ASR, stop the LLM, and stop Home Assistant one by one to verify which physical switches and fallback controls truly remain independent.
Prove gains with a fixed test set and rollback plan
One smooth demo proves very little. Build a fixed evaluation set covering duplicate room names, negations, slow pauses, TV noise, self-playback, unauthorized commands, and unavailable states—keeping tuning phrases separate from acceptance phrases. Hold speaker, distance, noise, volume, and scoring steady across versions:
| Stage | Metrics to log | Pitfall to avoid |
|---|---|---|
| Wake | False wakes per fixed window; missed valid wakes | Stable wake does not mean accurate ASR |
| Chinese transcription | Normalized CER; separate counts for negation, device, room errors | Low CER can hide a dropped “don't” |
| Intent & target | Action, entity, and parameter accuracy on clean transcripts | Plausible replies do not prove right targets |
| Execution | Confirmed, rejected, wrong, partial, and unknown counts | Never lump safety refusals into failure rate |
| Latency | End-of-speech to first reply and state confirmation (p50/p95, with N) | Best-case runs mask tail delays |
| Degradation | Available vs. rejected entrances per failed service | Internet loss is only one failure mode |
Keep safety refusals strictly separate from wrong actions; combining them into a single failure metric pressures teams to weaken necessary guards. After any mis-execution, immediately revoke the script's voice exposure and sentence automation, preserve traces, and roll back to the last verified bundle without changing models, aliases, and scripts simultaneously. For partially completed physical routines, read current device states before compensating—never blindly replay the entire scene.
A local voice stack is ready to expand when it can answer four questions for every run: What words were transcribed? Why was this entity chosen? Which rule permitted execution? What final state was confirmed? Close any gap in that chain before giving the assistant freer conversation.
Frequently Asked Questions
1. Can Home Assistant Speech-to-Phrase handle Chinese voice commands out of the box?
No. As of November 2026, the official Speech-to-Phrase repository migration notes do not list Chinese among served languages. Evaluate a multilingual Whisper model (never .en) or another Chinese-capable ASR engine with original-language transcription.
2. Does Home Assistant's “Acts as user” stop guests or a TV from unlocking doors? No. “Acts as user” runs actions under a selected account without identifying the speaker. Treat shared-room microphones as low-trust entrances, exclude locks and hazardous loads from voice exposure, and audit every exposed script's full call chain.
3. How do you stop a local LLM from turning a one-time light adjustment into a permanent rule? Separate one-off execution from persistent configuration: let voice scripts modify only current states, keep policy helpers hidden from voice tools, and require a human administrator to review and apply any persistent rule diff.
Related reading: For the wall-panel interaction and hardware side of this architecture, read the companion guide Upgrading a Smart Control Panel for AI: Fix the Interaction Before Replacing the Board. For deciding how to split local, cloud, and hybrid voice pipelines, see Home Assistant voice: local, cloud or hybrid.
