通过 OpenHue CLI 控制 Philips Hue 灯光、场景、房间
前置条件
# Linux (预构建二进制)
curl -sL https://github.com/openhue/openhue-cli/releases/latest/download/openhue-linux-amd64 -o ~/.local/bin/openhue && chmod +x ~/.local/bin/openhue
# macOS
brew install openhue/cli/openhue-cli
首次运行需要按下 Hue Bridge 上的按钮进行配对。网桥必须与运行机器在同一局域网内。
使用场景
- "开/关灯"
- "调暗客厅灯光"
- "设置场景"或"电影模式"
- 控制特定的 Hue 房间、区域或单个灯泡
- 调整亮度、颜色或色温
常用命令
列出资源
openhue get light # 列出所有灯光
openhue get room # 列出所有房间
openhue get scene # 列出所有场景
控制灯光
# 开/关
openhue set light "Bedroom Lamp" --on
openhue set light "Bedroom Lamp" --off
# 亮度 (0-100)
openhue set light "Bedroom Lamp" --on --brightness 50
# 色温 (暖到冷: 153-500 mirek)
openhue set light "Bedroom Lamp" --on --temperature 300
# 颜色 (名称或十六进制)
openhue set light "Bedroom Lamp" --on --color red
openhue set light "Bedroom Lamp" --on --rgb "#FF5500"
控制房间
# 关闭整个房间
openhue set room "Bedroom" --off
# 设置房间亮度
openhue set room "Bedroom" --on --brightness 30
场景
openhue set scene "Relax" --room "Bedroom"
openhue set scene "Concentrate" --room "Office"
快速预设
# 睡前 (暗暖)
openhue set room "Bedroom" --on --brightness 20 --temperature 450
# 工作模式 (亮冷)
openhue set room "Office" --on --brightness 100 --temperature 250
# 电影模式 (暗)
openhue set room "Living Room" --on --brightness 10
# 全部关闭
openhue set room "Bedroom" --off
openhue set room "Office" --off
openhue set room "Living Room" --off
注意事项
- Bridge 必须与运行 Hermes 的机器在同一局域网内
- 首次运行需要物理按下 Hue Bridge 上的按钮授权
- 颜色只在支持颜色的灯泡上有效(非仅白光型号)
- 灯光和房间名称区分大小写——用
openhue get light 检查确切名称
- 非常适合配合 cron 任务实现定时照明(如睡前调暗、起床调亮)
安装指南
复制下方命令,在终端运行即可安装此技能:
# 安装到当前项目
npx skills add openhue
# 全局安装 — 所有项目可用
npx skills add openhue -g
# 指定 Agent 安装
npx skills add openhue -a claude-code
评论区