Skip to content
Agentmart
Submit a tool

switchbot

This skill should be used when the user asks to "turn on the light", "turn off the AC", "open the curtain", "lock the door", "check room temperature", "list…

Skill by ar90n

IndexedMIT
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/ar90n-switchbot

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

This skill should be used when the user asks to "turn on the light", "turn off the AC", "open the curtain", "lock the door", "check room temperature", "list my devices", or needs to control any SwitchBot smart home device.

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/switchbot

What's inside

Skill name
switchbot
Description
This skill should be used when the user asks to "turn on the light", "turn off the AC", "open the curtain", "lock the door", "check room temperature", "list my devices", or needs to control any SwitchBot smart home device.
License
MIT
Instructions
120 lines in SKILL.md · view on GitHub

Before installing

  • Instructions call the network

Files (1)

  • SKILL.md

SKILL.md (first lines)

# SwitchBot

Control SwitchBot devices via the Web API (v1.1).

Requires `SWITCHBOT_TOKEN` and `SWITCHBOT_SECRET` environment variables
(from SwitchBot app > Profile > Preferences > Developer Options).

## Authentication

Every API call needs signed headers. Generate them with:

```bash
eval $(python3 -c "
import time,hashlib,hmac,base64,uuid,os
token=os.environ['SWITCHBOT_TOKEN']
secret=os.environ['SWITCHBOT_SECRET']
nonce=str(uuid.uuid4())
t=str(int(time.time()*1000))
sign=base64.b64encode(hmac.new(secret.encode(),f'{token}{t}{nonce}'.encode(),hashlib.sha256).digest()).decode()
print(f'export SB_HEADERS=(-H \"Authorization: {token}\" -H \"sign: {sign}\" -H \"t: {t}\" -H \"nonce: {nonce}\" -H \"Content-Type: application/json\")')
")
```

Headers expire quickly. Regenerate before each request.

## API

Base URL: `https://api.switch-bot.com/v1.1`

### List devices

```bash
curl -sf "${SB_HEADERS[@]}" https://api.switch-bot.com/v1.1/devices | jq .
```

Returns `body.deviceList` (physical) and `body.infraredRemoteList` (IR virtual).
Each device has `deviceId`, `deviceName`, `deviceType`.

Run this first to discover device IDs, then remember them for the session.

### Device status

```bash
curl -sf "${SB_HEADERS[@]}" "https://api.switch-bot.com/v1.1/devices/${DEVICE_ID}/status" | jq .
```

### Send command

```bash
curl -sf "${SB_HEADERS[@]}" -X POST \
  "https://api.switch-bot.com/v1.1/devices/${DEVICE_ID}/commands" \
  -d '{"command":"turnOn","parameter":"default","commandType":"command"}'
```

### Execute scene

```bash
# List scenes
curl -sf "${SB_HEADERS[@]}" https://api.switch-bot.com/v1.1/scenes | jq .

# Execute
curl -sf "${SB_HEADERS[@]}" -X POST \
  "https://api.switch-bot.com/v1.1/scenes/${SCENE_ID}/execute"
```

## Command Reference

### Physical Devices

| Device | Commands | Parameters |
|---|---|---|
| Bot | `turnOn`, `turnOff`, `press` | default |
| Plug / Plug Mini | `turnOn`, `turnOff` | default |
| Color Bulb | `turnOn`, `turnOff`, `setBrightness`, `setColor` | brightness: 1-100, color: `"255:128:0"` (R:G:B) |
| Strip Light | `turnOn`, `turnOff`, `setBrightness`, `setColor` | same as Color Bulb |
| Ceiling Light | `turnOn`, `turnOff`, `setBrightness`, `setColorTemperature` | brightness: 1-100, colorTemperature: 2700-6500 |
| Curtain / Curtain 3 | `turnOn`, `turnOff`, `setPosition` | position: `"0,ff,{0-100}"` (0=open, 100=closed) |
| Lock | `lock`, `unlock` | default |
| Humidifier | `turnOn`, `turnOff`, `setMode` | auto / 101-103 / 0-100 (%) |

### IR Virtual Devices (commandType: "customize")

For IR remotes learned in the SwitchBot app, use `commandType: "customize"`:

```bash
curl -sf "${SB_HEADERS[@]}" -X POST \
  "https://api.switch-bot.com/v1.1/devices/${DEVICE_ID}/commands" \
  -d '{"command":"turnOn","parameter":"default","commandType":"customize"}'
```

| Device | Commands |
|---|---|
| Air Conditioner | `setAll` with parameter `"{temp},{mode},{fan},{power}"` |
| TV / IPTV / STB | `turnOn`, `turnOff`, `SetChannel`, `volumeAdd`, `volumeSub` |
| Fan | `turnOn`, `turnOff`, `swing`, `lowSpeed`, `middleSpeed`, `highSpeed` |
| Light | `turnOn`, `turnOff`, `brightnessUp`, `brightnessDown` |

**Air Conditioner `setAll` parameter format:** `"{temp},{mode},{fan},{power}"`
- temp: temperature in celsius
- mode: 1=auto, 2=cool, 3=dry, 4=fan, 5=heat
- fan: 1=auto, 2=low, 3=medium, 4=high
- power: on/off

Example: `"26,2,1,on"` = 26°C, cool, auto fan, power on

## Workflow

1. Generate auth headers (see above)
2. `GET /devices` to list all devices (first time per session)
3. Match user's request to a device by name
4. `POST /devices/{id}/commands` to control it
5. Confirm the action to the user

## Error Handling

- Missing env vars: report that SwitchBot is not configured
- API error (statusCode != 100): report the error message
- Device not found: list available devices and ask user to clarify

From ar90n/claude-inbox, MIT.

More from ar90n/claude-inbox

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
Feb 26, 2026 (8 months ago)
Last release
Mar 11, 2026 (7 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from ar90n

Cite this page

switchbot skill. Agent Mart. https://agentmart.dev/skills/ar90n-switchbot (last updated 2026-10-24)