switchbot-openapi
Control and query SwitchBot devices using the official OpenAPI (v1.1). Use when the user asks to list SwitchBot devices, get device status, or send commands (turn on/off, press, set mode, lock/unlock, set temperature, curtain open %, etc.). Requires SWITCHBOT_TOKEN and SWITCHBOT_SECRET.
- License 许可
- MIT
- 最近更新
- 2026-04-05
- Stars
- ★ 7
- Forks
- 1
01 前言 Front Matter
- name
- switchbot-openapi
- description
- Control and query SwitchBot devices using the official OpenAPI (v1.1). Use when the user asks to list SwitchBot devices, get device status, or send commands (turn on/off, press, set mode, lock/unlock, set temperature, curtain open %, etc.). Requires SWITCHBOT_TOKEN and SWITCHBOT_SECRET.
02 资源文件 10
- 参考文档_meta.json288 B
- 参考文档README-CLAWHUB.md4.1 KB
- 参考文档references/commands.md1.0 KB
- 参考文档references/examples.md744 B
- 脚本scripts/execute_scene.sh612 B
- 脚本scripts/get_status.sh551 B
- 脚本scripts/list_devices.sh522 B
- 脚本scripts/list_scenes.sh537 B
- 脚本scripts/send_command.sh768 B
- 脚本scripts/switchbot_cli.js6.7 KB
03 SKILL.md 正文
SwitchBot OpenAPI Skill
This skill equips the agent to operate SwitchBot devices via HTTPS requests to the official OpenAPI. It includes ready-to-run scripts and curl templates; use these instead of re-deriving the HMAC signature each time.
Quick Start (Operator)
- Set environment variables in the OpenClaw Gateway/container:
- SWITCHBOT_TOKEN: your OpenAPI token
- SWITCHBOT_SECRET: your OpenAPI secret
- SWITCHBOT_REGION (optional): default
global(api.switch-bot.com). Options:global,na,eu,jp.
- Test a call (list devices):
- Bash:
scripts/list_devices.sh - Node:
node scripts/switchbot_cli.js list
- Common tasks:
- Get a device status:
node scripts/switchbot_cli.js status <deviceId> - Turn on:
node scripts/switchbot_cli.js cmd <deviceId> turnOn - Turn off:
node scripts/switchbot_cli.js cmd <deviceId> turnOff - Press (bot):
node scripts/switchbot_cli.js cmd <deviceId> press - Curtain 50%:
node scripts/switchbot_cli.js cmd <deviceId> setPosition --pos 50 - Lock/Unlock (Lock):
node scripts/switchbot_cli.js cmd <deviceId> lock/unlock
API Notes (concise)
Base URL by region:
- global: https://api.switch-bot.com
- na: https://api.switch-bot.com
- eu: https://api.switch-bot.com
- jp: https://api.switch-bot.com
Use path prefix /v1.1.
Headers (required):
- Authorization: <SWITCHBOT_TOKEN>
- sign: HMAC-SHA256 of (token + timestamp + nonce) using SECRET, Base64-encoded
- t: milliseconds epoch as string
- nonce: random UUID
- Content-Type: application/json
Key endpoints:
- GET /v1.1/devices
- GET /v1.1/devices/{deviceId}/status
- POST /v1.1/devices/{deviceId}/commands
- body: { "command": "turnOn|turnOff|press|lock|unlock|setPosition|setTemperature|setMode|setVolume", "parameter": "<string>", "commandType": "command" }
- Scenes (fallback when a model has no public commands):
- GET /v1.1/scenes
- POST /v1.1/scenes/{sceneId}/execute
Notes on limitations:
- Some models (e.g., certain Robot Vacuum lines) do NOT expose direct commands in OpenAPI v1.1. When a command returns {statusCode:160, message:"unknown command"}, create a Scene in the SwitchBot app (e.g., "Vacuum Start") and execute it via the Scenes API.
For command parameters, see references/commands.md. Scenes usage examples are in references/examples.md.
How the Agent Should Use This Skill
- Prefer running the provided scripts. They compute signatures and handle retries.
- Preflight guard: the CLI checks device capabilities before sending commands. For Bluetooth-class devices (e.g., Bot/Lock/Curtain), it requires
enableCloudService=trueand a non-emptyhubDeviceId. If missing, it aborts with a clear fix (bind a Hub and enable Cloud Services in the SwitchBot app). - If environment variables are missing, ask the user to provide/define them securely (do not log secrets).
- For sensitive actions (e.g., unlock), require explicit confirmation and optionally a one-time code if the user enables it.
- On errors with code 190/TokenInvalid or 100/Unauthorized: re-check token/secret, time drift, or signature composition.
Files
- scripts/switchbot_cli.js — Node CLI for list/status/commands
- scripts/list_devices.sh — curl listing
- scripts/get_status.sh — curl status
- scripts/send_command.sh — curl command
- references/commands.md — parameters for common devices
- references/examples.md — example invocations and JSON outputs
Keep this SKILL.md lean; consult references/ for details.
04 同仓库更多 Skills
zyfai
Earn yield on any Ethereum wallet on Base, Arbitrum, and Plasma. Use when a user wants passive DeFi yield on their funds. Deploys a non-custodial subaccount (Safe) linked to their EOA, enables automated yield optimization, and lets them deposit/withdraw anytime.
zerion-api
暂无简介
zerion-api-skill
暂无简介
zerion-api-mcp
暂无简介
yahoo-finance-forex
Fetches real-time FOREX news and market data from Yahoo Finance for major currency pairs (EUR/USD, GBP/USD, USD/JPY, etc.). Analyzes sentiment and provides trading context.
yahoo-finance
This skill should be used when the user asks to "get stock prices", "check stock quotes", "look up earnings", "get financial data", "find trending stocks", or needs stock market data from Yahoo Finance.