返回顶部
h

homeassistant-skillHomeAssistant技能

>

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 2.1.0
安全检测
已通过
4,848
下载量
免费
免费
7
收藏
概述
安装方式
版本历史

homeassistant-skill

Home Assistant 技能

通过 Home Assistant REST API 控制智能家居设备。

设置

设置环境变量:

  • - HAURL — 你的 Home Assistant URL(例如 http://10.0.0.10:8123)
  • HATOKEN — 长期访问令牌(在 HA → 个人资料 → 长期访问令牌中创建)

安全规则

在执行以下操作前,务必先征得用户确认:

  • - 门锁 — 锁定或解锁任何门锁
  • 报警面板 — 布防或撤防
  • 车库门 — 打开或关闭(cover.* 且 device_class: garage)
  • 安全自动化 — 禁用与安全相关的自动化
  • 卷帘/遮阳帘 — 打开或关闭控制物理通道的卷帘(大门、闸门)

未经用户明确确认,切勿对安全敏感设备进行操作。

实体发现

列出所有实体

bash
curl -s $HAURL/api/states -H Authorization: Bearer $HATOKEN \
| jq -r .[].entity_id | sort

按域列出实体

bash

开关


curl -s $HAURL/api/states -H Authorization: Bearer $HATOKEN \
| jq -r .[] | select(.entityid | startswith(switch.)) | \(.entityid): \(.state)

灯光

curl -s $HAURL/api/states -H Authorization: Bearer $HATOKEN \ | jq -r .[] | select(.entityid | startswith(light.)) | \(.entityid): \(.state)

传感器

curl -s $HAURL/api/states -H Authorization: Bearer $HATOKEN \ | jq -r .[] | select(.entityid | startswith(sensor.)) | \(.entityid): \(.state) \(.attributes.unitofmeasurement // )

替换域前缀(switch.、light.、sensor. 等)以发现任何域中的实体。

获取单个实体状态

bash
curl -s $HAURL/api/states/ENTITYID -H Authorization: Bearer $HA_TOKEN

区域与楼层发现

使用模板 API 查询区域、楼层和标签。

bash

列出所有区域


curl -s -X POST $HA_URL/api/template \
-H Authorization: Bearer $HA_TOKEN \
-H Content-Type: application/json \
-d {template: {{ areas() }}}

特定区域中的实体

curl -s -X POST $HA_URL/api/template \ -H Authorization: Bearer $HA_TOKEN \ -H Content-Type: application/json \ -d {template: {{ area_entities(\kitchen\) }}}

仅区域中的灯光

curl -s -X POST $HA_URL/api/template \ -H Authorization: Bearer $HA_TOKEN \ -H Content-Type: application/json \ -d {template: {{ area_entities(\kitchen\) | select(\match\, \light.\) | list }}}

查找实体所属区域

curl -s -X POST $HA_URL/api/template \ -H Authorization: Bearer $HA_TOKEN \ -H Content-Type: application/json \ -d {template: {{ area_name(\light.kitchen\) }}}

列出所有楼层及其区域

curl -s -X POST $HA_URL/api/template \ -H Authorization: Bearer $HA_TOKEN \ -H Content-Type: application/json \ -d {template: {% for floor in floors() %}{{ floor }}: {{ floor_areas(floor) }}\n{% endfor %}}

开关

bash

打开


curl -s -X POST $HAURL/api/services/switch/turnon \
-H Authorization: Bearer $HA_TOKEN \
-H Content-Type: application/json \
-d {entityid: switch.officelamp}

关闭

curl -s -X POST $HAURL/api/services/switch/turnoff \ -H Authorization: Bearer $HA_TOKEN \ -H Content-Type: application/json \ -d {entityid: switch.officelamp}

切换

curl -s -X POST $HA_URL/api/services/switch/toggle \ -H Authorization: Bearer $HA_TOKEN \ -H Content-Type: application/json \ -d {entityid: switch.officelamp}

灯光

bash

带亮度打开


curl -s -X POST $HAURL/api/services/light/turnon \
-H Authorization: Bearer $HA_TOKEN \
-H Content-Type: application/json \
-d {entityid: light.livingroom, brightness_pct: 80}

带颜色打开(RGB)

curl -s -X POST $HAURL/api/services/light/turnon \ -H Authorization: Bearer $HA_TOKEN \ -H Content-Type: application/json \ -d {entityid: light.livingroom, rgb_color: [255, 150, 50]}

带色温打开(微倒度)

curl -s -X POST $HAURL/api/services/light/turnon \ -H Authorization: Bearer $HA_TOKEN \ -H Content-Type: application/json \ -d {entityid: light.livingroom, color_temp: 300}

关闭

curl -s -X POST $HAURL/api/services/light/turnoff \ -H Authorization: Bearer $HA_TOKEN \ -H Content-Type: application/json \ -d {entityid: light.livingroom}

场景

bash
curl -s -X POST $HAURL/api/services/scene/turnon \
-H Authorization: Bearer $HA_TOKEN \
-H Content-Type: application/json \
-d {entityid: scene.movietime}

脚本

bash

列出所有脚本


curl -s $HAURL/api/states -H Authorization: Bearer $HATOKEN \
| jq -r .[] | select(.entityid | startswith(script.)) | \(.entityid): \(.state)

运行脚本

curl -s -X POST $HAURL/api/services/script/turnon \ -H Authorization: Bearer $HA_TOKEN \ -H Content-Type: application/json \ -d {entityid: script.bedtimeroutine}

带变量运行脚本

curl -s -X POST $HAURL/api/services/script/bedtimeroutine \ -H Authorization: Bearer $HA_TOKEN \ -H Content-Type: application/json \ -d {variables: {brightness: 20, delay_minutes: 5}}

自动化

bash

列出所有自动化


curl -s $HAURL/api/states -H Authorization: Bearer $HATOKEN \
| jq -r .[] | select(.entityid | startswith(automation.)) | \(.entityid): \(.state)

触发自动化

curl -s -X POST $HA_URL/api/services/automation/trigger \ -H Authorization: Bearer $HA_TOKEN \ -H Content-Type: application/json \ -d {entityid: automation.morningroutine}

启用自动化

curl -s -X POST $HAURL/api/services/automation/turnon \ -H Authorization: Bearer $HA_TOKEN \ -H Content-Type: application/json \ -d {entityid: automation.morningroutine}

禁用自动化

curl -s -X POST $HAURL/api/services/automation/turnoff \ -H Authorization: Bearer $HA_TOKEN \ -H Content-Type: application/json \ -d {entityid: automation.morningroutine}

气候控制

bash

获取恒温器状态


curl -s $HAURL/api/states/climate.thermostat -H Authorization: Bearer $HATOKEN \
| jq {state: .state, currenttemp: .attributes.currenttemperature, target_temp: .attributes.temperature}

设置温度

curl -s

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 homeassistant-skill-1776331145 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 homeassistant-skill-1776331145 技能

通过命令行安装

skillhub install homeassistant-skill-1776331145

下载

⬇ 下载 homeassistant-skill v2.1.0(免费)

文件大小: 7.1 KB | 发布时间: 2026-4-17 16:04

v2.1.0 最新 2026-4-17 16:04
- Added a homepage link to the skill metadata.
- Updated metadata fields to include OpenClaw environment and binary requirements.
- Bumped version to 2.1.0.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部