Browser & AutomationDocumentedScanned

hass-cli

Control Home Assistant devices and automations via hass-cli.

Share:

Installation

npx clawhub@latest install hass-cli

View the full skill documentation and source below.

Documentation

Home Assistant CLI

Control Home Assistant via hass-cli.

Install

# macOS (Homebrew)
brew install homeassistant-cli

# pip (any platform)
pip install homeassistant-cli

# Verify
hass-cli --version

Setup

1. Find Your Home Assistant URL

Common URLs (try in order):

  • — Default mDNS hostname - — If using Docker/hostname

  • — Direct IP (e.g., )

  • — If using Nabu Casa cloud Test it: open the URL in a browser — you should see the HA login page. ### 2. Create a Long-Lived Access Token 1. Open Home Assistant in your browser 2. Click your **profile** (bottom-left of the sidebar, your name/icon) 3. Scroll down to **Long-Lived Access Tokens** 4. Click **Create Token** 5. Give it a name (e.g., "Clawdbot" or "CLI") 6. **Copy the token immediately** — you won't see it again! The token looks like: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3... ### 3. Configure Environment Variables Add to your shell profile (~/.zshrc or ~/.bashrc): __CODE_BLOCK_1__ Or for Clawdbot, store credentials in TOOLS.md: __CODE_BLOCK_2__ Then reference TOOLS.md before making calls. ## Quick Reference __CODE_BLOCK_3__ ## Entity Naming Patterns - light. — Lights - switch. — Switches, plugs, relays - sensor. — Temperature, humidity, power, etc. - binary_sensor. — Motion, door/window, presence - climate. — Thermostats, HVAC - cover. — Blinds, garage doors - media_player. — TVs, speakers - automation. — Automations - script. — Scripts - scene. — Scenes ## Discovery Tips __CODE_BLOCK_4__ ## Notes - Empty [] response from service calls = success - Use exact entity_id from state list`

  • Multiple arguments: comma-separated (no spaces)

  • If hass-cli unavailable, use REST API as fallback:

curl -s -H "Authorization: Bearer $HASS_TOKEN" "$HASS_SERVER/api/states" | jq