Talk to your Home Assistant from your Terminal. This tiny CLI lets you connect to your Voice pipeline of Home Assistant, send intents, and chat interactively, right from the command line. Once registered, the ha command is available everywhere on your machine.
To be able to chat with your Home Assistant, you first have to set up a working voice pipeline in Home Assistant itself. There is plenty of documentation on official Home Assistant website.
Prerequisites:
- Node.js (v22 or higher)
- A working voice assistant pipeline in Home Assistant
Follow these steps:
- Clone the repo
git clone https://github.com/orangecoding/ha-terminal-assistant.git cd ha-terminal-assistant - Configure your environment
- Copy the example file and edit the values:
cp .env.example .env - Open
.envand set your details:
# Required HATOKEN=your-long-lived-access-token HAURL=192.168.123.45:8123 # host:port of your Home Assistant # Optional: choose your package manager (auto-detects if omitted) # One of: pnpm | yarn | npm RUNTIME=pnpm - Register the CLI globally Use whichever package manager you prefer (or have installed). Any of these will work:
# Using pnpm pnpm run register # Using npm npm run register # Using yarn yarn run register This does two things:
- Exposes the
hacommand globally - Stores your project root path so
haknows where to run from
- Use it from anywhere From any directory on your machine, run:
ha connect You can also pass a one‑off prompt directly:
ha connect "turn on the living room light" Or stay in interactive mode and just type away. exit quits.
- Token safety: your
HATOKENgrants API access — keep.envprivate. - Runtime choice: set
RUNTIMEin.envto lock topnpm,yarn, ornpm. If not set, the tool auto‑detects (pnpm → yarn → npm). - Yarn v1 users: if you’re on Yarn classic,
registerhandles the global install using an absolutefile:path to avoid version quirks. - Need to re‑register? Just run the relevant
run registercommand again.
- “Project root variable is not set” when running
ha:- Run the register step again (pnpm/npm/yarn
run register). Restart your shell (orsource ~/.zshrc) if needed.
- Run the register step again (pnpm/npm/yarn
- “Runtime Not Found” block:
- Install one of:
pnpm,yarn, ornpm, or setRUNTIMEin your.envto one that you have installed.
- Install one of:
Built with ❤️ by Christian Kellner
