Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Safe Voice Commands for My Home Automation Server

Description and use

A home‑automation voice‑control system uses a regex whitelist to allow only approved commands, falling back to an LLM for variations.

Problem

Voice assistants can misinterpret speech‑to‑text, potentially triggering dangerous actions; a deterministic gate was needed to allow only approved commands.

Outcome

The system now safely processes voice commands, rejecting any that do not match the whitelist and only allowing a small, auditable set of actions.

Workflow

  • 1. Create a JSON whitelist of regex patterns and corresponding actions.
  • 2. Load the whitelist in the server code.
  • 3. On receiving a transcript, iterate over the whitelist and test each pattern (case‑insensitive).
  • 4. If a match is found, return the associated action and execute it (e.g., send MQTT or run a script).
  • 5. If no match, call the LLM with a narrow prompt that lists allowed actions and expects one keyword or "unknown".
  • 6. If the LLM returns a known action, execute it; otherwise reject the command and log a warning.

Evidence

filter everything through a whitelist regular expression before handing the text to a language model

Source

I kept the whitelist in a JSON file so I could edit it without touching code.

Source

run the regex first, and only if it fails do I fall back to the LLM with a very narrow prompt

Source

  • Record date: 2026-10-17T13:56:08.295Z