home-assistant
Control Home Assistant devices via REST API
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Control Home Assistant devices via REST API
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Create and manage isolated git worktrees safely.
Opinionated workflow for submodule development + PRs + control-center pointer bumps.
Store Apple notarization IDs in Keychain and notarize/staple OpenWork DMGs locally.
Sync control-center master and update submodule pointers safely.
Require every OpenCode plugin to expose get_skills and get_version tools.
Use client.app.log() instead of console.log in OpenCode plugins
| name | home-assistant |
| description | Control Home Assistant devices via REST API |
Before using this skill, verify credentials are configured:
source .env && echo "HA URL: $HA_URL" && echo "Token: ${HA_TOKEN:0:10}..."
If this shows nothing or errors, guide the user through First-Time Setup below.
Credentials are stored in .env (gitignored):
HA_URL=http://homeassistant.local:8123
HA_TOKEN=your-long-lived-access-token
source .env && curl -s -H "Authorization: Bearer $HA_TOKEN" "$HA_URL/api/"
# Should return: {"message": "API running."}
source .env && curl -s -H "Authorization: Bearer $HA_TOKEN" "$HA_URL/api/states" | head -100
source .env && curl -s -H "Authorization: Bearer $HA_TOKEN" "$HA_URL/api/states/light.living_room"
source .env && curl -s -X POST -H "Authorization: Bearer $HA_TOKEN" \
-H "Content-Type: application/json" \
-d '{"entity_id": "light.living_room"}' \
"$HA_URL/api/services/light/turn_on"
source .env && curl -s -X POST -H "Authorization: Bearer $HA_TOKEN" \
-H "Content-Type: application/json" \
-d '{"entity_id": "light.living_room"}' \
"$HA_URL/api/services/light/turn_off"
source .env && curl -s -X POST -H "Authorization: Bearer $HA_TOKEN" \
-H "Content-Type: application/json" \
-d '{"entity_id": "light.living_room"}' \
"$HA_URL/api/services/light/toggle"
# Turn on with brightness
curl -s -X POST -H "Authorization: Bearer $HA_TOKEN" \
-H "Content-Type: application/json" \
-d '{"entity_id": "light.bedroom", "brightness": 128}' \
"$HA_URL/api/services/light/turn_on"
curl -s -X POST -H "Authorization: Bearer $HA_TOKEN" \
-H "Content-Type: application/json" \
-d '{"entity_id": "switch.coffee_maker"}' \
"$HA_URL/api/services/switch/turn_on"
curl -s -X POST -H "Authorization: Bearer $HA_TOKEN" \
-H "Content-Type: application/json" \
-d '{"entity_id": "climate.thermostat", "temperature": 72}' \
"$HA_URL/api/services/climate/set_temperature"
curl -s -X POST -H "Authorization: Bearer $HA_TOKEN" \
-H "Content-Type: application/json" \
-d '{"entity_id": "vacuum.roborock"}' \
"$HA_URL/api/services/vacuum/start"
curl -s -X POST -H "Authorization: Bearer $HA_TOKEN" \
-H "Content-Type: application/json" \
-d '{"entity_id": "scene.movie_mode"}' \
"$HA_URL/api/services/scene/turn_on"
| Domain | Pattern | Example |
|---|---|---|
| Lights | light.<name> | light.bedroom_ceiling |
| Switches | switch.<name> | switch.coffee_maker |
| Sensors | sensor.<name> | sensor.temperature |
| Climate | climate.<name> | climate.thermostat |
| Vacuum | vacuum.<name> | vacuum.roomba |
| Scene | scene.<name> | scene.movie_time |
http://homeassistant.local:8123Tell the user:
- Open Home Assistant web UI
- Click your profile (bottom left corner)
- Go to Security tab
- Scroll to Long-Lived Access Tokens
- Click Create Token, name it (e.g., "OpenCode")
- Copy the token immediately (it won't be shown again!)
cat >> .env << 'EOF'
# Home Assistant
HA_URL=http://homeassistant.local:8123
HA_TOKEN=your-long-lived-token-here
EOF
source .env && curl -s -H "Authorization: Bearer $HA_TOKEN" "$HA_URL/api/"
# Should return: {"message": "API running."}
| Endpoint | Method | Description |
|---|---|---|
/api/ | GET | Check API status |
/api/states | GET | Get all entity states |
/api/states/<entity_id> | GET | Get single entity |
/api/services/<domain>/<service> | POST | Call a service |
/api/services | GET | List available services |
| Code | Meaning |
|---|---|
| 200 | Success |
| 401 | Unauthorized (bad/expired token) |
| 404 | Entity not found |