Homey - Home Automation技能使用说明
2026-04-01
新闻来源:网淘吧
围观:11
电脑广告
手机广告
Homey CLI
安全、对代理友好的 CLI,用于控制 Homey 家庭自动化集线器。
此技能提供的功能
- 设备控制:开关设备、调光灯亮度、改变颜色、设置温度
- 设备检查:列出设备、检查状态、读取功能
- 区域管理:列出区域及各区域内的设备
- 流程控制:列出并触发流程
- 库存概览:获取集线器完整概览
设置步骤
1. 安装依赖项
cd skills/homey-cli
npm install
2. 创建 Homey 应用凭据
- 前往https://tools.developer.homey.app/tools/app
- 创建新应用,需包含:
- 回调 URL:
http://localhost:8787/callback - 记下您的客户端ID与客户端密钥
- 回调 URL:
3. 配置环境
创建.env文件:

export HOMEY_CLIENT_ID="your-client-id"
export HOMEY_CLIENT_SECRET="your-client-secret"
export HOMEY_REDIRECT_URL="http://localhost:8787/callback"
4. 登录
bash run.sh auth login
在浏览器中遵循OAuth流程。令牌存储在~/.config/homey-cli/目录下。
使用说明
列出Homey设备
bash run.sh homey list
选择活动Homey
bash run.sh homey use <homeyId>
设备操作
# 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
流程操作
# List flows
bash run.sh flows list
# Trigger flow
bash run.sh flows trigger <flowId>
完整清单
bash run.sh inventory --json
安全模型
为确保安全,写入操作已按能力设置白名单:
- 默认允许:
开关控制、调光、light_hue,light_saturation,light_temperature,target_temperature - 通过以下方式覆盖:
export HOMEY_CLI_ALLOWED_CAPABILITIES=onoff,dim,target_temperature
不支持破坏性操作(删除设备、修改流程、更改应用设置)。 .常见查询
当用户询问:
"打开厨房的灯" → 列出设备,找到匹配项,使用
- devices on <deviceId>
"将客厅调暗至50%" → 找到设备,使用 - devices dim <deviceId> 0.5
"卧室的温度是多少?" → 找到设备,使用 - devices read <deviceId> measure_temperature
"列出我所有的灯" → 使用 - devices list --json
devices list --json并按类别/功能筛选
配置存储
- 令牌:
~/.config/homey-cli/credentials.json - 活动Homey:
~/.config/homey-cli/config.json
故障排除
- 认证错误:重新运行
bash run.sh auth login - 设备未找到:使用以下命令检查设备名称/ID
bash run.sh devices list - 功能不被允许:添加到
HOMEY_CLI_ALLOWED_CAPABILITIES或检查是否为只读功能
文章底部电脑广告
手机广告位-内容正文底部


微信扫一扫,打赏作者吧~