← 返回 Skills 市场
eohmig

Home Assistant Backup

作者 eohmig · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
50
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install home-assistant-backup
功能描述
Control Home Assistant smart home devices, run automations, and receive webhook events. Use when controlling lights, switches, climate, scenes, scripts, or a...
使用说明 (SKILL.md)

Home Assistant

Control your smart home via Home Assistant's REST API and webhooks.

Setup

Option 1: Config File (Recommended)

Create ~/.config/home-assistant/config.json:

{
  "url": "https://your-ha-instance.duckdns.org",
  "token": "your-long-lived-access-token"
}

Option 2: Environment Variables

export HA_URL="http://homeassistant.local:8123"
export HA_TOKEN="your-long-lived-access-token"

Getting a Long-Lived Access Token

  1. Open Home Assistant → Profile (bottom left)
  2. Scroll to "Long-Lived Access Tokens"
  3. Click "Create Token", name it (e.g., "Clawdbot")
  4. Copy the token immediately (shown only once)

Quick Reference

List Entities

curl -s -H "Authorization: Bearer $HA_TOKEN" "$HA_URL/api/states" | jq '.[].entity_id'

Get Entity State

curl -s -H "Authorization: Bearer $HA_TOKEN" "$HA_URL/api/states/light.living_room"

Control Devices

# Turn on
curl -X POST -H "Authorization: Bearer $HA_TOKEN" -H "Content-Type: application/json" \
  "$HA_URL/api/services/light/turn_on" -d '{"entity_id": "light.living_room"}'

# Turn off
curl -X POST -H "Authorization: Bearer $HA_TOKEN" -H "Content-Type: application/json" \
  "$HA_URL/api/services/light/turn_off" -d '{"entity_id": "light.living_room"}'

# Set brightness (0-255)
curl -X POST -H "Authorization: Bearer $HA_TOKEN" -H "Content-Type: application/json" \
  "$HA_URL/api/services/light/turn_on" -d '{"entity_id": "light.living_room", "brightness": 128}'

Run Scripts & Automations

# Trigger script
curl -X POST -H "Authorization: Bearer $HA_TOKEN" "$HA_URL/api/services/script/turn_on" \
  -H "Content-Type: application/json" -d '{"entity_id": "script.goodnight"}'

# Trigger automation
curl -X POST -H "Authorization: Bearer $HA_TOKEN" "$HA_URL/api/services/automation/trigger" \
  -H "Content-Type: application/json" -d '{"entity_id": "automation.motion_lights"}'

Activate Scenes

curl -X POST -H "Authorization: Bearer $HA_TOKEN" "$HA_URL/api/services/scene/turn_on" \
  -H "Content-Type: application/json" -d '{"entity_id": "scene.movie_night"}'

Common Services

Domain Service Example entity_id
light turn_on, turn_off, toggle light.kitchen
switch turn_on, turn_off, toggle switch.fan
climate set_temperature, set_hvac_mode climate.thermostat
cover open_cover, close_cover, stop_cover cover.garage
media_player play_media, media_pause, volume_set media_player.tv
scene turn_on scene.relax
script turn_on script.welcome_home
automation trigger, turn_on, turn_off automation.sunrise

Inbound Webhooks (HA → Clawdbot)

To receive events from Home Assistant automations:

1. Create HA Automation with Webhook Action

# In HA automation
action:
  - service: rest_command.notify_clawdbot
    data:
      event: motion_detected
      area: living_room

2. Define REST Command in HA

# configuration.yaml
rest_command:
  notify_clawdbot:
    url: "https://your-clawdbot-url/webhook/home-assistant"
    method: POST
    headers:
      Authorization: "Bearer {{ webhook_secret }}"
      Content-Type: "application/json"
    payload: '{"event": "{{ event }}", "area": "{{ area }}"}'

3. Handle in Clawdbot

Clawdbot receives the webhook and can notify you or take action based on the event.

CLI Wrapper

The scripts/ha.sh CLI provides easy access to all HA functions:

# Test connection
ha.sh info

# List entities
ha.sh list all          # all entities
ha.sh list lights       # just lights
ha.sh list switch       # just switches

# Search entities
ha.sh search kitchen    # find entities by name

# Get/set state
ha.sh state light.living_room
ha.sh states light.living_room   # full details with attributes
ha.sh on light.living_room
ha.sh on light.living_room 200   # with brightness (0-255)
ha.sh off light.living_room
ha.sh toggle switch.fan

# Scenes & scripts
ha.sh scene movie_night
ha.sh script goodnight

# Climate
ha.sh climate climate.thermostat 22

# Call any service
ha.sh call light turn_on '{"entity_id":"light.room","brightness":200}'

Troubleshooting

  • 401 Unauthorized: Token expired or invalid. Generate a new one.
  • Connection refused: Check HA_URL, ensure HA is running and accessible.
  • Entity not found: List entities to find the correct entity_id.

API Reference

For advanced usage, see references/api.md.

安全使用建议
Install only if you are comfortable giving the agent authenticated control over Home Assistant. Use a dedicated least-privilege Home Assistant account if possible, protect the token file with restrictive permissions, avoid exposing tokens or webhook IDs, prefer HTTPS/WSS, and require explicit confirmation before actions involving locks, garage doors/covers, alarms, climate, scripts, automations, or generic service calls.
能力标签
requires-oauth-tokenrequires-sensitive-credentials
能力评估
Purpose & Capability
The core purpose is coherent: controlling Home Assistant devices, scenes, scripts, automations, and querying state. The concern is breadth: it exposes generic service calls and automation/script execution that can affect physical devices such as covers, climate systems, and any configured Home Assistant service.
Instruction Scope
Activation and examples are broad, including 'any HA entity' and 'call any service,' without confirmation guidance for high-impact actions or warnings about chained automations and physical side effects.
Install Mechanism
No suspicious package installation was found. The skill declares curl and jq requirements and provides a shell wrapper, which matches its documented REST API approach.
Credentials
Network access to a Home Assistant instance and use of authenticated API calls are expected, but the authority is high-impact because successful commands can change a user's physical environment.
Persistence & Privilege
The setup recommends storing a long-lived Home Assistant access token in a local JSON config file, but does not document restrictive file permissions, token rotation, or the risks of exposing that credential.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install home-assistant-backup
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /home-assistant-backup 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release of home-assistant-backup skill. - Control Home Assistant smart home devices, automations, and scenes via REST API. - Supports inbound webhook triggers from Home Assistant automations. - Provides CLI wrapper (`scripts/ha.sh`) for easy command-line control. - Setup via config file or environment variables. - Includes troubleshooting tips and quick-reference API examples.
元数据
Slug home-assistant-backup
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Home Assistant Backup 是什么?

Control Home Assistant smart home devices, run automations, and receive webhook events. Use when controlling lights, switches, climate, scenes, scripts, or a... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 50 次。

如何安装 Home Assistant Backup?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install home-assistant-backup」即可一键安装,无需额外配置。

Home Assistant Backup 是免费的吗?

是的,Home Assistant Backup 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Home Assistant Backup 支持哪些平台?

Home Assistant Backup 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Home Assistant Backup?

由 eohmig(@eohmig)开发并维护,当前版本 v1.0.0。

💬 留言讨论