Homey CLI:智能家居自动化控制 - Openclaw Skills

作者:互联网

2026-04-17

AI快讯

什么是 Homey CLI?

Homey CLI 提供了一个安全且对智能体友好的界面,用于与 Homey 家庭自动化中心进行交互。它使技术用户和 AI 智能体无需 GUI 即可管理各种智能家居设备,包括灯光、恒温器和插座。本工具在构建时充分考虑了安全性,利用功能白名单模型来防止未经授权的破坏性操作。

通过将此技能与 Openclaw Skills 集成,开发人员可以弥合 AI 驱动逻辑与物理硬件之间的鸿沟,允许通过简单的命令行执行来实现复杂的家庭自动化场景。对于那些希望以编程方式检查设备状态或在智能家居生态系统中触发流程的用户来说,该工具是理想之选。

下载入口:https://github.com/openclaw/skills/tree/main/skills/krausefx/homey-cli

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install homey-cli

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 /skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 homey-cli。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

Homey CLI 应用场景

  • 自动化灯光管理,包括开关、调光和颜色调节。
  • 监控环境状态,如温度读取和实时设备可用性。
  • 通过定时任务或 AI 驱动的提示触发复杂的 Homey 流程。
  • 生成家庭自动化设备的完整清单,用于审计或报告。
  • 组织和检查特定区域内分组的智能设备。
Homey CLI 工作原理
  1. 用户通过 Homey 开发者门户进行身份验证以获取 OAuth 凭据(客户端 ID 和密钥)。
  2. CLI 使用提供的凭据通过 OAuth 流程与 Homey 中心建立安全连接。
  3. 用户或 AI 智能体查询中心以列出可用设备、区域或自动化流程。
  4. 通过白名单功能向中心发送特定命令,以读取传感器数据或更改设备状态。
  5. 功能白名单确保仅在物理硬件上执行安全、预先批准的操作。

Homey CLI 配置指南

首先,为 Openclaw Skills 库的此部分安装必要的依赖项:

cd skills/homey-cli
npm install

接下来,在 Homey 开发者门户 (tools.developer.homey.app) 创建一个新应用以获取凭据,然后配置您的 .env 文件:

export HOMEY_CLIENT_ID="your-client-id"
export HOMEY_CLIENT_SECRET="your-client-secret"
export HOMEY_REDIRECT_URL="http://localhost:8787/callback"

最后,对 CLI 进行身份验证并按照浏览器提示操作:

bash run.sh auth login

Homey CLI 数据架构与分类体系

该技能通过特定文件和标准化的 JSON 输出管理其配置和状态,以在 Openclaw Skills 中保持一致的结构:

数据元素 路径 / 格式 描述
OAuth 令牌 ~/.config/homey-cli/credentials.json 存储 Homey API 的访问令牌和刷新令牌。
活动中心 ~/.config/homey-cli/config.json 记录当前目标的 Homey 中心 ID。
设备元数据 JSON 对象 标准化输出,包括设备 ID、类别、区域和当前功能状态。
name: homey-cli
description: Control Homey home automation hub via CLI. Use when you need to control smart home devices (lights, thermostats, sockets, etc.), check device status, list zones, trigger flows, or perform any Homey automation tasks. Supports on/off, dimming, color changes, temperature control, and device inspection. Safe, capability-allowlisted operations only.

Homey CLI

Safe, agent-friendly CLI for controlling Homey home automation hubs.

What This Skill Provides

  • Device control: Turn devices on/off, dim lights, change colors, set temperatures
  • Device inspection: List devices, check status, read capabilities
  • Zone management: List zones and devices per zone
  • Flow control: List and trigger flows
  • Inventory: Get complete hub overview

Setup

1. Install Dependencies

cd skills/homey-cli
npm install

2. Create Homey App Credentials

  1. Go to https://tools.developer.homey.app/tools/app
  2. Create a new app with:
    • Callback URL: http://localhost:8787/callback
    • Note your Client ID and Client Secret

3. Configure Environment

Create .env file:

export HOMEY_CLIENT_ID="your-client-id"
export HOMEY_CLIENT_SECRET="your-client-secret"
export HOMEY_REDIRECT_URL="http://localhost:8787/callback"

4. Login

bash run.sh auth login

Follow the OAuth flow in your browser. Tokens are stored in ~/.config/homey-cli/.

Usage

List Homeys

bash run.sh homey list

Select Active Homey

bash run.sh homey use 

Device Operations

# List all devices
bash run.sh devices list

# List devices as JSON
bash run.sh devices list --json

# Get specific device
bash run.sh devices get 

# Read capability value
bash run.sh devices read  onoff

# Control devices
bash run.sh devices on 
bash run.sh devices off 
bash run.sh devices dim  0.4
bash run.sh devices color  #FF8800
bash run.sh devices temperature  21.5

Flow Operations

# List flows
bash run.sh flows list

# Trigger flow
bash run.sh flows trigger 

Complete Inventory

bash run.sh inventory --json

Safety Model

Write operations are capability-allowlisted for safety:

  • Default allowed: onoff, dim, light_hue, light_saturation, light_temperature, target_temperature
  • Override via: export HOMEY_CLI_ALLOWED_CAPABILITIES=onoff,dim,target_temperature

Destructive operations (delete devices, modify flows, change app settings) are not supported.

Common Queries

When users ask:

  • "Turn on the kitchen lights" → List devices, find match, use devices on
  • "Dim living room to 50%" → Find device, use devices dim 0.5
  • "What's the temperature in the bedroom?" → Find device, use devices read measure_temperature
  • "List all my lights" → Use devices list --json and filter by class/capabilities

Configuration Storage

  • Tokens: ~/.config/homey-cli/credentials.json
  • Active Homey: ~/.config/homey-cli/config.json

Troubleshooting

  • Auth errors: Re-run bash run.sh auth login
  • Device not found: Check device name/ID with bash run.sh devices list
  • Capability not allowed: Add to HOMEY_CLI_ALLOWED_CAPABILITIES or check if it's a read-only capability

相关推荐