Home Assistant (REST) — Quick Use
Security first
- •Prefer a dedicated Home Assistant user for this assistant.
- •Use a Long-Lived Access Token (LLAT) from that user.
- •Never commit tokens to git; store them in
secrets/(gitignored). - •If HA is exposed on the public internet, ensure HTTPS, strong auth, and ideally IP restrictions / VPN.
Setup (one-time)
- •Set your HA base URL (you have:
https://ghar.nicolaischmid.de). - •Save token to a local secret file:
- •
mkdir -p /root/.openclaw/workspace/secrets - •
chmod 700 /root/.openclaw/workspace/secrets - •write token to:
/root/.openclaw/workspace/secrets/ha_token - •
chmod 600 /root/.openclaw/workspace/secrets/ha_token
- •
Optional env overrides:
- •
HA_URL(default taken fromsecrets/ha_urlif present) - •
HA_TOKEN(default read fromsecrets/ha_token)
Inventory / context
- •The current device/entity overview lives in:
- •
skills/homeassistant/references/inventory-nice.md(most useful controls) - •
skills/homeassistant/references/inventory.md(broader controllable list)
- •
- •Refresh anytime by running:
- •
node scripts/ha-refresh-context.mjs
- •
Commands
Wrapper script (JSON by default):
- •
Ping:
- •
node scripts/ha.mjs ping
- •
- •
Get entity state:
- •
node scripts/ha.mjs state light.living_room
- •
- •
Call a service:
- •
node scripts/ha.mjs call light turn_on '{"entity_id":"light.living_room","brightness_pct":50}'
- •
- •
List entities (compact):
- •
node scripts/ha.mjs list --domain light
- •
REST endpoints (reference)
- •
GET /api/ - •
GET /api/states/<entity_id> - •
POST /api/services/<domain>/<service>with JSON body
Docs: