ASP源码
PHP源码
.NET源码
JSP源码
Home Assistant 控制是一个专门为希望通过 AI 编码代理管理其智能家居生态系统的开发人员和高级用户设计的集成。通过利用 Home Assistant REST API 和长效访问令牌,此技能实现了与实体、服务、场景和脚本的无缝交互。它弥补了复杂的家庭自动化逻辑与自然语言执行之间的差距,使其成为使用 Openclaw Skills 构建个性化自动化工作流的基础。
该技能的构建侧重于可靠性和开发人员体验,具有用于实体发现、状态验证和安全操作执行的脚本。无论您是在调整照明、监控传感器数据,还是触发复杂的安全场景,此技能都提供了一种结构化且安全的方式,直接从您的开发环境与 Home Assistant 实例进行交互。
下载入口:https://github.com/openclaw/skills/tree/main/skills/hogar23/home-assistant-control
从源直接安装技能的最快方式。
npx clawhub@latest install home-assistant-control
将技能文件夹复制到以下位置之一
全局模式~/.openclaw/skills/
工作区
/skills/
优先级:工作区 > 本地 > 内置
将此提示词复制到 OpenClaw 即可自动安装。
请帮我使用 Clawhub 安装 home-assistant-control。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。
要开始在您的 Openclaw Skills 集合中使用此集成,请按照以下步骤操作:
# 设置您的 Home Assistant 凭据
export HA_TOKEN="your_long_lived_access_token"
export HA_URL_PUBLIC="https://your-ha-instance.duckdns.org"
# 可选:设置本地 URL 以实现更快的网络访问
export HA_URL_LOCAL="http://192.168.1.100:8123"
# 运行自检脚本以验证连接性
./scripts/self_check.sh
# 生成您的实体清单
./scripts/fill_entities_md.sh
确保您的环境中可以使用 bash、curl 和 jq。
该技能通过以下文件结构组织其操作数据和上下文:
| 文件路径 | 描述 | 数据类型 |
|---|---|---|
references/entities.md |
可用 Home Assistant 实体及其当前状态的完整清单。 | Markdown 表格 |
references/naming-context.md |
将自然语言名称链接到技术实体 ID 的自定义映射。 | Markdown 列表 |
scripts/ha_call.sh |
用于处理 HTTP 请求和身份验证的核心 API 封装程序。 | Bash 脚本 |
scripts/ha_safe_action.sh |
用于执行带有手动确认触发器的高风险服务的逻辑。 | Bash 脚本 |
name: home-assistant-control
description: Control and inspect Home Assistant via REST API for entities, states, services, scenes, scripts, and automations. Use when the user asks to turn devices on/off, set values like brightness or temperature, trigger scenes/scripts/automations, or check current home/sensor status.
homepage: https://github.com/Hogar23/home-assistant-control
metadata:
{
"openclaw": {
"emoji": "??",
"requires": {
"bins": ["bash", "curl", "jq"],
"env": ["HA_TOKEN", "HA_URL_PUBLIC"]
}
}
}
Use Home Assistant REST API with a long-lived access token.
bashcurljqHA_TOKEN)HA_URL_PUBLIC)python3pyyaml (required by skill-creator validator/packager scripts)HA_TOKEN (required)HA_URL_PUBLIC (required; canonical target and fallback)HA_URL_LOCAL is set (and no HA_URL override), local is tried first, then fallback to HA_URL_PUBLICHA_URL is an explicit override (if set, used directly)HA_ENV_FILE=/absolute/path/to/file.env when you want file-based secret loading.HA_ENV_FILE is not set, scripts only use environment variables already present in the shell.scripts/ha_call.sh and scripts/self_check.sh load env file only when HA_ENV_FILE is provided.references/naming-context.md for manual alias mappings first.GET /api/statesGET /api/states/{entity_id}POST /api/services/{domain}/{service}Headers:
Authorization: Bearer $HA_TOKENContent-Type: application/jsonscripts/ha_env.sh — loads env file only when HA_ENV_FILE is explicitly set, using safe KEY=VALUE parsing (no source/eval).scripts/ha_call.sh — generic API caller for Home Assistant.scripts/fill_entities_md.sh — generate references/entities.md from GET /api/states.
./scripts/fill_entities_md.sh./scripts/fill_entities_md.sh --domains light,switch,climate,sensorscripts/save_naming_context.sh — refresh references/naming-context.md for user-specific naming.
./scripts/save_naming_context.shscripts/ha_entity_find.sh — search entities by partial entity id or friendly name.
./scripts/ha_entity_find.sh kitchen./scripts/ha_entity_find.sh temp --domains sensor,climate --limit 30scripts/ha_safe_action.sh — execute service actions with safety checks and risk confirmation.
./scripts/ha_safe_action.sh light turn_on light.kitchen '{"brightness_pct":60}'./scripts/ha_safe_action.sh lock unlock lock.front_door --dry-run--yes to bypass interactive confirmation for risky domains.scripts/self_check.sh — verify prerequisites and API connectivity/auth before running actions.
./scripts/self_check.sh/api/...).HA_URL*), prefer HTTPS for public access.source on untrusted paths.references/entities.md — entity inventoryreferences/naming-context.md — user alias memory for natural names (e.g. "living room light")example_* IDs), no personal hostnames/tokens..env or any private env file with real tokens.