Reference

Environment Variables

A copy-paste-ready matrix of every env var the server reads, plus a worked example.


This page is the canonical reference for the server’s environment variables. The shorter Configuration > Environment page is the guided tour; this is the lookup table.

Full matrix

Required

VariableTypeDefaultValidation
HASS_HOSTURLhttp://homeassistant.local:8123Zod-validated; must be a valid URL.
HASS_TOKENstringRequired in production; skipped when SMITHERY_SCAN=true or empty.
JWT_SECRETstringZod min(32); required by the custom HTTP entry point.

Server

VariableTypeDefault
PORTnumber4000
NODE_ENVenumdevelopment
HOSTstring127.0.0.1 (standalone) / 0.0.0.0 (Docker)

Logging

VariableTypeDefault
LOG_LEVELenuminfo
LOG_DIRpathlogs
LOG_MAX_SIZEsize20m
LOG_MAX_DAYSduration14d
LOG_COMPRESSbooleanfalse
LOG_REQUESTSbooleanfalse

Rate limiting

VariableTypeDefault
RATE_LIMIT_WINDOWminutes15
RATE_LIMIT_MAXnumber100

Server-Sent Events

VariableTypeDefault
SSE_MAX_CLIENTSnumber1000
SSE_PING_INTERVALmilliseconds30000

Speech

VariableTypeDefault
ENABLE_SPEECH_FEATURESbooleanfalse
ENABLE_WAKE_WORDbooleanfalse
ENABLE_SPEECH_TO_TEXTbooleanfalse
WHISPER_MODEL_PATHpath/models
WHISPER_MODEL_TYPEenumbase

Tool toggles

Per-tool disable, e.g. TOOL_TEXT_TO_SPEECH_DISABLED=true, TOOL_VOICE_COMMAND_PARSER_DISABLED=true. Set to true to remove the tool from tools/list. See Configuration > Tools for the pattern.

Worked example

A .env for a LAN-only server talking to HA on the same network:

# === Required ===
HASS_HOST=http://192.168.1.50:8123
HASS_TOKEN=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOi...
JWT_SECRET=dGhpcyBpcyBhIDUxMi1iaXQgcmFuZG9tIHZhbHVlIHVzZWQgZm9yIHRoZSBqd3QK

# === Server ===
PORT=4000
HOST=127.0.0.1
NODE_ENV=production

# === Logging ===
LOG_LEVEL=info
LOG_DIR=./logs
LOG_MAX_SIZE=20m
LOG_MAX_DAYS=14
LOG_COMPRESS=true
LOG_REQUESTS=false

# === Rate limiting ===
RATE_LIMIT_WINDOW=15
RATE_LIMIT_MAX=200

# === SSE ===
SSE_MAX_CLIENTS=50
SSE_PING_INTERVAL=30000

# === Speech (off) ===
ENABLE_SPEECH_FEATURES=false

Generate JWT_SECRET:

openssl rand -base64 64

Loading order

dotenv is loaded by the entry points before the config schema parses. Later env vars override earlier ones, so a shell-set HASS_HOST beats a .env entry. Useful for local override during development.

Validation errors

If a required var is missing or invalid, the process exits with a clear error. Example:

ZodError: [
  {
    "code": "too_small",
    "minimum": 32,
    "type": "string",
    "inclusive": true,
    "exact": false,
    "message": "JWT_SECRET must be at least 32 characters (use a secure random value)",
    "path": ["JWT_SECRET"]
  }
]

Fix the offending var and restart. The process won’t proceed without a valid config.

Next