微算力 · API 导航与自营网关
API 接入 EN
未登录登录
🏠

安全可控的智能家居中枢

homey-cli · vv1.0.0
专业技能 安全 S 级 作者 KrauseFx 公开目录收录
下载 1.9k 安装 708 收藏 4.9k 浏览 21.3k
原始页面

简介

由 fastlane 创始人 Felix Krause 开发的 Homey 智能家居 CLI 控制文档,支持安全白名单化的设备操控与自动化管理,零代码风险、本地凭据存储。

原始描述

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 是一个面向 Homey 智能家居中枢的纯文档型 CLI 控制指南,旨在帮助用户通过命令行安全地管理智能设备。用户需先完成 OAuth 应用注册与本地环境配置,随后即可执行设备开关、调光调色、温控调节、区域管理及流程触发等操作。所有交互均通过 bash run.sh 命令完成,支持 JSON 格式输出便于脚本集成。

显著优点

安全设计突出:采用能力白名单机制,默认仅允许 onoff、、dim、、light_hue 等基础操作,明确禁止删除设备、修改流程等破坏性动作,大幅降低误操作风险。来源可信:作者 Felix Krause 为知名 iOS 安全研究员及 fastlane 创始人,技术背景扎实。隐私友好:OAuth Token 完全本地存储于 ~/.config/homey-cli/,无云端数据上传。功能覆盖全面:涵盖设备控制、状态查询、区域管理、流程触发及完整库存导出,满足日常自动化需求。零代码侵入:Skill 本身为纯 Markdown 文档,无可执行代码,用户完全掌控执行时机。

潜在缺点与局限性

纯文档依赖:Skill 不直接执行任何操作,所有功能需用户手动运行外部命令,自动化程度受限。配置门槛较高:需自行注册 Homey 开发者应用、配置 OAuth 回调地址及环境变量,对非技术用户不够友好。功能边界受限:明确不支持删除设备、修改系统设置等高级操作,复杂场景需借助官方工具。外部工具依赖:实际功能依赖用户自行安装的 homey-cli 工具,版本兼容性需自行维护。无实时反馈机制:文档型设计意味着无内置错误处理或状态监控,问题排查依赖用户手动诊断。

适合的目标群体

技术型智能家居用户:熟悉命令行操作、希望批量管理设备的进阶用户。开发者与集成工程师:需要将 Homey 控制集成到脚本、CI/CD 或自定义应用中的技术人员。隐私敏感用户:偏好本地凭据存储、拒绝云端授权方案的安全意识群体。自动化爱好者:希望通过脚本实现定时任务、场景联动的智能家居玩家。

使用风险

OAuth 凭据泄露风险:Client ID/Secret 若保管不当或误提交至版本控制,可能导致未授权访问。Token 本地存储风险:~/.config/homey-cli/credentials.json 文件权限配置不当可能被其他应用读取。操作误执行风险:虽有能力白名单保护,但用户手动输入命令时仍可能选错设备 ID。外部工具供应链风险:homey-cli 工具本身的安全更新、依赖漏洞需用户自行跟踪。环境配置漂移:多 Homey 设备切换或配置变更时,可能因状态文件混乱导致操作对象错误。

技能正文


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 <homeyId>

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 <deviceId>

# Read capability value
bash run.sh devices read <deviceId> onoff

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

Flow Operations

# List flows
bash run.sh flows list

# Trigger flow
bash run.sh flows trigger <flowId>

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 <deviceId>
  • "Dim living room to 50%" → Find device, use devices dim <deviceId> 0.5
  • "What's the temperature in the bedroom?" → Find device, use devices read <deviceId> 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

正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。

标签

automationiotsmart-homecliproductivity

同类 Skill