# Home Assistant Skill
Control smart home devices via Home Assistant API.
## Skill Metadata
- **Name**: homeassistant
- **Type**: OpenClaw Skill
- **Purpose**: Control lights, switches, covers, climate, scenes, scripts via HA API
## Setup Commands
### Prerequisites
1. Home Assistant running on local network
2. Long-Lived Access Token from HA Profile page
### Configuration (One-Command)
```bash
# Run this to configure
ha-cli setup <HA_URL> <TOKEN>
# Example:
ha-cli setup 192.168.1.100 your_long_lived_token_here
```
Or set environment variables:
```bash
export HA_URL="http://homeassistant.local:8123"
export HA_TOKEN="your_token_here"
```
## Usage Commands
### Basic Control
```bash
# Turn on device (any type)
ha-cli on <device_name>
ha-cli <device_name> on
# Turn off device
ha-cli off <device_name>
ha-cli <device_name> off
```
### Brightness & Color
```bash
# Set brightness (0-100)
ha-cli brightness <0-100> <device_name>
ha-cli <device_name> brightness 75
# Set RGB color
ha-cli rgb #RRGGBB <device_name>
ha-cli rgb #FF5500 "Living Room"
```
### Temperature
```bash
# Set temperature
ha-cli <temperature> <thermostat_name>
ha-cli 22 thermostat
```
### Scenes & Scripts
```bash
# Activate scene
ha-cli scene <scene_name>
ha-cli scene movie
# Run script
ha-cli script <script_name>
ha-cli script morning
```
### Status & Discovery
```bash
# Check HA status
ha-cli status
ha-cli info
# List all entities
ha-cli list
ha-cli list entities
# List by domain
ha-cli list light
ha-cli list switch
ha-cli list climate
```
## Supported Device Types
| Domain | Commands | Examples |
|--------|----------|----------|
| light | on, off, brightness, rgb | `ha-cli on living room` |
| switch | on, off | `ha-cli off tv` |
| cover | open, close, stop | `ha-cli open blinds` |
| climate | temperature, mode | `ha-cli 22 thermostat` |
| lock | lock, unlock | `ha-cli lock front door` |
| scene | activate | `ha-cli scene movie` |
| script | run | `ha-cli script morning` |
## En...
README excerpt
# Home Assistant CLI for OpenClaw
A streamlined Home Assistant CLI for OpenClaw with one-command setup and natural language control.
## Features
- **One-command setup**: `ha-cli setup <url> <token>`
- **Natural commands**: `ha-cli on living room` or `ha-cli living room on`
- **Smart fuzzy matching**: "bed" finds "Bedroom Light", "Bedroom AC"
- **Auto-config save**: Credentials stored in config.json
- **Any device type**: Lights, switches, covers, climate, locks, scenes, scripts
## Quick Start
```bash
# One-command setup
ha-cli setup 192.168.1.100 your_long_lived_token
# Control devices
ha-cli on living room
ha-cli off bedroom light
ha-cli 22 thermostat
ha-cli scene movie
# Check status
ha-cli status
ha-cli list light
```
## Setup
### 1. Get Long-Lived Access Token
1. Open Home Assistant Web UI
2. Click your username (Profile)
3. Scroll to "Long-Lived Access Tokens"
4. Click "Create Token"
5. Copy the token
### 2. Configure
```bash
# Replace with your HA IP and token
ha-cli setup 192.168.1.100 your_token_here
```
That's it! Configuration is saved automatically.
## Commands
### Basic Control
```bash
# Turn on/off (works with any device)
ha-cli on living room
ha-cli off bedroom light
ha-cli open garage
ha-cli close blinds
ha-cli lock front door
# Alternative: name first
ha-cli living room on
ha-cli bedroom light off
```
### Brightness & Color
```bash
ha-cli brightness 75 living room
ha-cli rgb #FF5500 desk lamp
```
### Temperature
```bash
ha-cli 22 thermostat
ha-cli temperature 24 bedroom
```
### Scenes & Scripts
```bash
ha-cli scene movie
ha-cli scene good morning
ha-cli script morning
```
### Status
```bash
ha-cli status # HA status overview
ha-cli list # All entities
ha-cli list light # Only lights
ha-cli list switch # Only switches
```
## Examples
```bash
# Morning routine
ha-cli scene good morning
ha-cli script morning_routine
# Movie time
ha-cli scene movie
ha-cli brightness 20 living room
# Goodnight...