name: roku
description: 通过命令行控制 Roku 设备。支持设备发现、遥控、应用启动、搜索,并提供 HTTP 桥接模式以实现实时控制。
homepage: https://github.com/gumadeiras/roku-cli
repository: https://github.com/gumadeiras/roku-cli
metadata: {"clawdbot":{"emoji":"📺","requires":{"bins":["roku"]},"install":[{"id":"node","kind":"node","package":"roku-ts-cli","bins":["roku"],"label":"通过 npm 安装 Roku CLI"}]}}
一个基于 TypeScript 的快速命令行工具,通过 ECP API 控制 Roku 设备。
npm install -g roku-ts-cli@latest
# 发现设备并保存别名
roku discover --save livingroom --index 1
# 使用别名
roku --host livingroom device-info
roku --host livingroom apps
| 命令 | 描述 |
|---|---|
roku discover |
在网络中查找 Roku 设备 |
roku --host <ip> device-info |
获取设备信息 |
roku --host <ip> apps |
列出已安装的应用 |
roku --host <ip> command <key> |
发送遥控按键指令 |
roku --host <ip> literal <text> |
输入文本 |
roku --host <ip> search --title <query> |
搜索内容 |
roku --host <ip> launch <app> |
启动应用 |
roku --host <ip> interactive |
进入交互式遥控模式 |
roku livingroom # 交互式控制
roku --host livingroom interactive # 同上
使用方向键、回车键、ESC 键进行类似遥控器的控制。
以原生操作系统服务的形式运行一个持久的 HTTP 桥接服务:
# 安装并启动服务
roku bridge install-service --port 19839 --token secret --host livingroom --user
roku bridge start --user
# 服务管理
roku bridge status --user
roku bridge stop --user
roku bridge uninstall --user
通过 HTTP 发送命令:
# 发送按键指令
curl -X POST http://127.0.0.1:19839/key \
-H "Content-Type: application/json" \
-H "Authorization: Bearer secret" \
-d '{"key":"home"}'
# 输入文本
curl -X POST http://127.0.0.1:19839/text \
-H "Content-Type: application/json" \
-H "Authorization: Bearer secret" \
-d '{"text":"hello"}'
# 启动应用
curl -X POST http://127.0.0.1:19839/launch \
-H "Content-Type: application/json" \
-H "Authorization: Bearer secret" \
-d '{"app":"plex"}'
# 健康检查
curl http://127.0.0.1:19839/health -H "Authorization: Bearer secret"
| 端点 | 请求体 |
|---|---|
POST /key |
{"key": "home"} |
POST /text |
{"text": "hello"} |
POST /search |
{"title": "Stargate"} |
POST /launch |
{"app": "plex"} |
GET /health |
— |
GET /health?deep=1 |
深度健康检查(探测 Roku 设备) |
# 保存设备别名
roku discover --save livingroom --index 1
roku alias set office 192.168.1.20
# 保存应用别名
roku alias set plex 13535
# 列出所有别名
roku alias list
# 使用别名
roku --host livingroom launch plex
home, back, select, up, down, left, right, play, pause, rev, fwd, replay, info, power, volume_up, volume_down, mute
--user 标志以用户空间服务运行(无需 sudo)--token 进行身份验证https://github.com/gumadeiras/roku-cli