Samsung Smart TV (SmartThings)
This skill provisions a SmartThings OAuth app and stores the credentials for Clawdbot.
Setup (one-time)
- - Create the SmartThings OAuth app headlessly (requires a PAT) and print a phone login URL, using plain text instructions only.
- Open the URL on your phone, log in, then copy the code query parameter from the redirect page and re-run to exchange it.
- If PAT app creation fails (403), create the app on a normal machine using the SmartThings CLI login flow and then set the client id/secret in the .env before running the code-exchange step.
- Re-run to refresh credentials: describe the action in plain text (no code snippets).
What it does
- - Creates an OAuth-In SmartApp with display name smartthings-clawdbot.
- Uses scopes r:devices: and x:devices: (read + execute commands).
- Redirect URI defaults to https://httpbin.org/get (can be overridden via redirect-uri option).
- Writes SMARTTHINGSAPPID, SMARTTHINGSCLIENTID, SMARTTHINGSCLIENTSECRET plus OAuth tokens to ~/.clawdbot/.env (or CLAWDBOTSTATEDIR/.env).
- Uses the SmartThings CLI to create the OAuth app when a PAT is provided.
- Exchanges the OAuth code for tokens via direct HTTPS to SmartThings (not via the CLI).
Device setup
- - Use the SmartThings CLI to list devices in JSON and locate the TV device id.
- Store it as SMARTTHINGSDEVICEID in the same .env file.
Common actions (plain text only)
- - List devices and capabilities via the SmartThings CLI.
- Check device status.
- Send switch/volume/mute commands to the TV device.
App launch (Netflix/Prime Video)
- - App launch is device-specific; look for applicationLauncher or samsungtv in capabilities.
- Discover app IDs in device status under supportedApps or installedApps.
- Launch apps using the SmartThings CLI and the appId from your TV.
- Example IDs are not universal; use the IDs listed for your TV.
App discovery (when a user asks to open a specific app)
- - First, open the target app manually on the TV.
- Then query device status and look for fields like tvChannelName, installedApps, or supportedApps to extract the current appId.
- Save the appId for future use; some IDs are device-specific.
- Known app id patterns (examples):
- Standard/global apps (often stable):
- Netflix: org.tizen.netflix-app
- Amazon Prime: org.tizen.primevideo
- Pattern: org.tizen.[app-name]
- Device-specific apps (vary per TV):
- YouTube: {random}.TizenYouTube
- Joyn: {random}.ZAPPNVOLLTVFREIGESTREAMT
- Pattern: {random}.{PackageName}
- - Avoid guessing; always confirm the appId from the TV’s status payload.
Notes
- - The script defaults to headless mode and will not open a browser.
- Provide a PAT via SMARTTHINGSTOKEN (or SMARTTHINGSPAT) to authenticate.
- Create a PAT here: https://account.smartthings.com/tokens
- OAuth flow: open the printed URL on your phone, then copy the code query parameter from the redirect page and re-run with auth-code.
- The default redirect uses https://httpbin.org/get to show the code in the URL; you can switch to your own redirect URI if you don’t want to use httpbin.
- Re-running the setup is safe; it updates the env entries in place.
- Response style: do not include code blocks or inline command snippets; use plain text steps only.
Samsung Smart TV (SmartThings)
此技能会配置一个SmartThings OAuth应用,并将凭证存储到Clawdbot中。
一次性设置
- - 以无头模式创建SmartThings OAuth应用(需要PAT),并打印手机登录URL,仅使用纯文本说明。
- 在手机上打开该URL,登录后,从重定向页面复制code查询参数,然后重新运行以完成交换。
- 如果PAT应用创建失败(403),请在普通机器上使用SmartThings CLI登录流程创建应用,然后在运行代码交换步骤前,在.env文件中设置客户端ID和密钥。
- 重新运行以刷新凭证:用纯文本描述该操作(不包含代码片段)。
功能说明
- - 创建一个显示名称为smartthings-clawdbot的OAuth-In智能应用。
- 使用作用域r:devices:和x:devices:(读取+执行命令)。
- 重定向URI默认为https://httpbin.org/get(可通过redirect-uri选项覆盖)。
- 将SMARTTHINGSAPPID、SMARTTHINGSCLIENTID、SMARTTHINGSCLIENTSECRET以及OAuth令牌写入~/.clawdbot/.env(或CLAWDBOTSTATEDIR/.env)。
- 当提供PAT时,使用SmartThings CLI创建OAuth应用。
- 通过直接HTTPS连接到SmartThings(而非通过CLI)将OAuth代码交换为令牌。
设备设置
- - 使用SmartThings CLI以JSON格式列出设备,并找到电视设备ID。
- 将其作为SMARTTHINGSDEVICEID存储在同一个.env文件中。
常见操作(仅限纯文本)
- - 通过SmartThings CLI列出设备和功能。
- 检查设备状态。
- 向电视设备发送开关/音量/静音命令。
应用启动(Netflix/Prime Video)
- - 应用启动因设备而异;在功能中查找applicationLauncher或samsungtv。
- 在设备状态的supportedApps或installedApps下发现应用ID。
- 使用SmartThings CLI和电视上的appId启动应用。
- 示例ID并非通用;请使用电视上列出的ID。
应用发现(当用户要求打开特定应用时)
- - 首先,在电视上手动打开目标应用。
- 然后查询设备状态,查找tvChannelName、installedApps或supportedApps等字段,以提取当前appId。
- 保存appId以备将来使用;某些ID因设备而异。
- 已知的应用ID模式(示例):
- 标准/全局应用(通常稳定):
- Netflix:org.tizen.netflix-app
- Amazon Prime:org.tizen.primevideo
- 模式:org.tizen.[应用名称]
- 设备特定应用(因电视而异):
- YouTube:{随机}.TizenYouTube
- Joyn:{随机}.ZAPPNVOLLTVFREIGESTREAMT
- 模式:{随机}.{包名}
- - 避免猜测;始终从电视的状态数据中确认appId。
注意事项
- - 脚本默认为无头模式,不会打开浏览器。
- 通过SMARTTHINGSTOKEN(或SMARTTHINGSPAT)提供PAT以进行身份验证。
- 在此处创建PAT:https://account.smartthings.com/tokens
- OAuth流程:在手机上打开打印的URL,然后从重定向页面复制code查询参数,并使用auth-code重新运行。
- 默认重定向使用https://httpbin.org/get在URL中显示代码;如果您不想使用httpbin,可以切换到自己的重定向URI。
- 重新运行设置是安全的;它会原地更新.env条目。
- 回复风格:不要包含代码块或内联命令片段;仅使用纯文本步骤。