This skill equips the agent to operate SwitchBot devices via HTTPS requests to the official OpenAPI v1.1. It includes ready-to-run scripts and a Node CLI; use these instead of re-deriving the HMAC signature each time.
1) Set environment variables:
2) Test (list devices):
scripts/list_devices.shnode scripts/switchbot_cli.js list3) Common tasks:
Basic controls:
node scripts/switchbot_cli.js listnode scripts/switchbot_cli.js status node scripts/switchbot_cli.js cmd turnOn / turnOffnode scripts/switchbot_cli.js cmd toggle node scripts/switchbot_cli.js cmd press Curtain / Curtain 3:
node scripts/switchbot_cli.js cmd setPosition --pos=50 (0=open, 100=closed; CLI auto-formats to 0,ff,50)
node scripts/switchbot_cli.js cmd pause Lock / Lock Pro / Lock Ultra / Lock Lite:
node scripts/switchbot_cli.js cmd lock / unlocknode scripts/switchbot_cli.js cmd deadbolt Lights (Color Bulb / Strip Light / Floor Lamp / Strip Light 3 / RGBICWW etc.):
node scripts/switchbot_cli.js cmd setColor --param="255:100:0" node scripts/switchbot_cli.js cmd setBrightness --param=80 node scripts/switchbot_cli.js cmd setColorTemperature --param=4000 Fans (Battery Circulator Fan / Circulator Fan / Standing Circulator Fan):
node scripts/switchbot_cli.js cmd setWindMode --param=natural node scripts/switchbot_cli.js cmd setWindSpeed --param=50 node scripts/switchbot_cli.js cmd setNightLightMode --param=1 node scripts/switchbot_cli.js cmd closeDelay --param=3600 Robot Vacuum S1/S1 Plus/K10+/K10+ Pro:
node scripts/switchbot_cli.js cmd start node scripts/switchbot_cli.js cmd stop node scripts/switchbot_cli.js cmd dock node scripts/switchbot_cli.js cmd PowLevel --param=2 Robot Vacuum K10+ Pro Combo / K20+ Pro / S10 / S20 / K11+:
node scripts/switchbot_cli.js cmd startClean --param='{"action":"sweep_mop","param":{"fanLevel":2,"waterLevel":1,"times":1}}' node scripts/switchbot_cli.js cmd pause / docknode scripts/switchbot_cli.js cmd setVolume --param=50 node scripts/switchbot_cli.js cmd selfClean --param=1 Weather Station:
node scripts/switchbot_cli.js cmd customQuote --param="大海啊,你好多的水啊!" (Max 100 characters; displayed on the AI Recommendations page)
node scripts/switchbot_cli.js cmd cancelCustom --param=default node scripts/switchbot_cli.js cmd customPage --param="自定义页面文本" (Max 100 characters)
Blind Tilt:
node scripts/switchbot_cli.js cmd setPosition --param="up;60" node scripts/switchbot_cli.js cmd fullyOpen node scripts/switchbot_cli.js cmd closeUp / closeDownRoller Shade:
node scripts/switchbot_cli.js cmd setPosition --param=50 Humidifier (original):
node scripts/switchbot_cli.js cmd setMode --param=auto Evaporative Humidifier / Auto-refill:
node scripts/switchbot_cli.js cmd setMode --param='{"mode":7,"targetHumidify":60}' node scripts/switchbot_cli.js cmd setChildLock --param=true Air Purifier (VOC/PM2.5/Table):
node scripts/switchbot_cli.js cmd setMode --param='{"mode":2,"fanGear":2}' node scripts/switchbot_cli.js cmd setChildLock --param=1 Smart Radiator Thermostat:
node scripts/switchbot_cli.js cmd setMode --param=1 node scripts/switchbot_cli.js cmd setManualModeTemperature --param=22 Relay Switch 1PM / 1 / 2PM:
node scripts/switchbot_cli.js cmd toggle node scripts/switchbot_cli.js cmd setMode --param=0 node scripts/switchbot_cli.js cmd turnOn --param="1" (channel 1 or 2)Garage Door Opener:
node scripts/switchbot_cli.js cmd turnOn / turnOffVideo Doorbell:
node scripts/switchbot_cli.js cmd enableMotionDetection / disableMotionDetectionCandle Warmer Lamp:
node scripts/switchbot_cli.js cmd setBrightness --param=50 AI Art Frame:
node scripts/switchbot_cli.js cmd next / previousnode scripts/switchbot_cli.js cmd uploadImage --param='{"imageUrl":"https://example.com/photo.jpg"}' node scripts/switchbot_cli.js cmd uploadImage --param='{"imageBase64":""}' imageUrl and imageBase64 are mutually exclusive. Max 10 images; statusCode 402 = limit reached.Keypad / Keypad Touch / Keypad Vision / Keypad Vision Pro:
node scripts/switchbot_cli.js cmd createKey --param='{"name":"Guest","type":"permanent","password":"12345678"}' node scripts/switchbot_cli.js cmd deleteKey --param='{"id":"11"}' IR Remote - Air Conditioner:
node scripts/switchbot_cli.js cmd setAll --param="26,2,1,on" (format: temperature, mode, fan speed, power state)
IR Remote - TV:
node scripts/switchbot_cli.js cmd SetChannel --param=5 node scripts/switchbot_cli.js cmd volumeAdd / volumeSubIR Remote - Others (DIY):
node scripts/switchbot_cli.js cmd --commandType=customize Scenes (fallback):
node scripts/switchbot_cli.js scenesnode scripts/switchbot_cli.js scene Base URL: https://api.switch-bot.com
Path prefix: /v1.1
Daily limit: 10,000 API calls
Headers (all required):
token + t + nonce, secret), Base64-encodedKey endpoints:
GET /v1.1/devices — list all devicesGET /v1.1/devices/{deviceId}/status — device statusPOST /v1.1/devices/{deviceId}/commands — send commandGET /v1.1/scenes — list scenesPOST /v1.1/scenes/{sceneId}/execute — execute sceneCommand body format:
{
"command": "<commandName>",
"parameter": "<string|object>",
"commandType": "command"
}
For IR "Others" (DIY) devices, use "commandType": "customize".
The OpenAPI does not have a dedicated families/rooms endpoint. Instead, extract this info from the device list response (GET /v1.1/devices).
Each device in deviceList includes:
familyName — the family/home it belongs toroomID — room identifier ("defaultRoom" means no specific room assigned)roomName — room display name (null if default room)When the user asks about families, homes, or rooms:
node scripts/switchbot_cli.js list to get the full device listfamilyName to get all familiesroomName (treat null/"defaultRoom" as "未分配房间")Example output format:
🏠 Home
└─ 未分配房间: 设备A, 设备B, ...
└─ 客厅: 设备C, ...
🏠 测试
└─ 未分配房间: 设备D, ...
Note: IR remote devices (infraredRemoteList) only have hubDeviceId, no familyName/roomName. To determine their family, match their hubDeviceId to a device in deviceList and use that device's family.
setAll is supported (not separate setMode/setTemp).scripts/switchbot_cli.js — Node CLI (list/status/cmd/scenes)scripts/list_devices.sh — curl: list devicesscripts/get_status.sh — curl: get statusscripts/send_command.sh — curl: send commandscripts/list_scenes.sh — curl: list scenesscripts/execute_scene.sh — curl: execute scenereferences/commands.md — complete command reference per device typereferences/examples.md — usage examples共 4 个版本