SwitchBot

App · 9 actions

Control your SwitchBot smart home: turn devices on or off, press a Bot, lock or unlock a door, move curtains, send any command to a device or infrared remote, read a device's status and run scenes. Start a workflow when a device's status changes.

Actions

ActionWhat it does
Get device statusRead a device's current status: whether it is on, its battery, a lock's state, a curtain's position, a sensor's temperature and humidity, and whatever else it reports.
List devicesList the devices in your SwitchBot account (Bots, plugs, curtains, locks, hubs, sensors) and the infrared remotes set up in the app, with their IDs and types.
List scenesList the manual scenes in your SwitchBot account with their IDs.
Lock or unlockLock or unlock a SwitchBot Lock.
Press botHave a SwitchBot Bot press its button once.
Run sceneRun one of your manual scenes, doing everything it is set up to do in the SwitchBot app.
Send commandSend any command a device or infrared remote takes, by SwitchBot's name for it, such as turnOn, setColor, setAll or a custom button.
Set curtain positionMove a SwitchBot Curtain or Roller Shade to a position, from 0 (open) to 100 (closed).
Turn device on or offTurn a Bot, plug, light, fan, appliance or infrared remote's appliance on or off.

Get device status

Read a device's current status: whether it is on, its battery, a lock's state, a curtain's position, a sensor's temperature and humidity, and whatever else it reports. Infrared remotes have no status.

Inputs

Devicedevice_idtextRequired
The SwitchBot device. Pick one, or give its ID from an earlier step.

Outputs

device_idtext
The device's ID
device_typetext
Its type, such as Bot or Meter
hub_device_idtext
The ID of the hub it connects through, if any
powertext
on or off, for a device that reports it; empty otherwise
statusobject
Every value SwitchBot reports for it, such as power, battery, lockState, slidePosition, temperature or humidity
Example output
{
  "device_id": "C271111EC0AB",
  "device_type": "Curtain3",
  "hub_device_id": "FA7310762361",
  "power": "",
  "status": {
    "battery": 80,
    "calibrate": true,
    "deviceId": "C271111EC0AB",
    "deviceType": "Curtain3",
    "group": false,
    "hubDeviceId": "FA7310762361",
    "moving": false,
    "slidePosition": 0,
    "version": "V4.2"
  }
}

List devices

List the devices in your SwitchBot account (Bots, plugs, curtains, locks, hubs, sensors) and the infrared remotes set up in the app, with their IDs and types.

Inputs

Typedevice_typetext
Only devices and remotes whose type contains this, such as Plug, Curtain, Lock or TV. Leave blank for all.

Outputs

device_countnumber
How many devices
deviceslist
The devices
remote_countnumber
How many remotes
remoteslist
The infrared remotes
Example output
{
  "device_count": 1,
  "devices": [
    {
      "cloud_service_enabled": true,
      "details": {
        "calibrate": true,
        "deviceId": "C271111EC0AB",
        "deviceName": "Living room curtain",
        "deviceType": "Curtain3",
        "enableCloudService": true,
        "group": false,
        "hubDeviceId": "FA7310762361",
        "master": true
      },
      "device_id": "C271111EC0AB",
      "hub_device_id": "FA7310762361",
      "name": "Living room curtain",
      "type": "Curtain3"
    }
  ],
  "remote_count": 1,
  "remotes": [
    {
      "device_id": "02-202008110034-13",
      "hub_device_id": "FA7310762361",
      "name": "Living room TV",
      "type": "TV"
    }
  ]
}

List scenes

List the manual scenes in your SwitchBot account with their IDs.

Inputs

None.

Outputs

countnumber
How many
sceneslist
The scenes
Example output
{
  "count": 1,
  "scenes": [
    {
      "name": "Movie night",
      "scene_id": "T02-202009221414-48924101"
    }
  ]
}

Lock or unlock

Lock or unlock a SwitchBot Lock.

Inputs

Devicedevice_idtextRequired
The lock. Pick one, or give its ID from an earlier step.
Lock or unlockoperationtextRequired
Whether to lock or unlock the door.One of: lock, unlock.

Outputs

The command sent

commandtext
The command, such as turnOn, press or setPosition
command_typetext
command, or customize for a custom button
device_idtext
The device the command went to
parametertext
The command's parameter, default when it takes none
responseobject
Anything SwitchBot sent back, often empty
summarytext
What was done, in words
Example output
{
  "command": "lock",
  "command_type": "command",
  "device_id": "C271111EC0AB",
  "parameter": "default",
  "response": {},
  "summary": "Locked"
}

Press bot

Have a SwitchBot Bot press its button once. Each run presses again.

Inputs

Devicedevice_idtextRequired
The Bot. Pick one, or give its ID from an earlier step.

Outputs

The command sent

commandtext
The command, such as turnOn, press or setPosition
command_typetext
command, or customize for a custom button
device_idtext
The device the command went to
parametertext
The command's parameter, default when it takes none
responseobject
Anything SwitchBot sent back, often empty
summarytext
What was done, in words
Example output
{
  "command": "press",
  "command_type": "command",
  "device_id": "C271111EC0AB",
  "parameter": "default",
  "response": {},
  "summary": "Pressed"
}

Run scene

Run one of your manual scenes, doing everything it is set up to do in the SwitchBot app.

Inputs

Scenescene_idtextRequired
The manual scene. Pick one, or give its ID from an earlier step.

Outputs

rantrue/false
Always true once it ran
scene_idtext
The scene run
Example output
{
  "ran": true,
  "scene_id": "T02-202009221414-48924101"
}

Send command

Send any command a device or infrared remote takes, by SwitchBot's name for it, such as turnOn, setColor, setAll or a custom button.

Inputs

Devicedevice_idtextRequired
The SwitchBot device or infrared remote. Pick one, or give its ID from an earlier step.
CommandcommandtextRequired
SwitchBot's name for the command, exactly as its API documentation spells it (such as turnOn, setBrightness or volumeAdd), or the name of a custom button.
Parameterparametertext
What the command takes, such as 122:80:20 for setColor or 26,1,3,on for an air conditioner's setAll. Leave blank for a command that takes nothing. A JSON object is sent as JSON.
Command typecommand_typetext
A built-in command, or a custom button you made for a remote in the SwitchBot app. Defaults to a built-in command.One of: command (A built-in command), customize (A custom button made in the SwitchBot app). Default: command.

Outputs

The command sent

commandtext
The command, such as turnOn, press or setPosition
command_typetext
command, or customize for a custom button
device_idtext
The device the command went to
parametertext
The command's parameter, default when it takes none
responseobject
Anything SwitchBot sent back, often empty
summarytext
What was done, in words
Example output
{
  "command": "setColor",
  "command_type": "command",
  "device_id": "C271111EC0AB",
  "parameter": "122:80:20",
  "response": {},
  "summary": "Sent setColor with \"122:80:20\""
}

Set curtain position

Move a SwitchBot Curtain or Roller Shade to a position, from 0 (open) to 100 (closed).

Inputs

Devicedevice_idtextRequired
The Curtain or Roller Shade. Pick one, or give its ID from an earlier step.
PositionpositionnumberRequired
How far closed, from 0 (fully open) to 100 (fully closed).From 0 to 100.
Speedmodetext
How a Curtain moves: faster, quieter, or as set in the app. A Roller Shade has no choice. Defaults to the curtain's own setting.One of: default (The curtain's own setting), performance (Performance (faster)), silent (Silent (quieter)). Default: default.

Outputs

The command sent

commandtext
The command, such as turnOn, press or setPosition
command_typetext
command, or customize for a custom button
device_idtext
The device the command went to
parametertext
The command's parameter, default when it takes none
responseobject
Anything SwitchBot sent back, often empty
summarytext
What was done, in words
Example output
{
  "command": "setPosition",
  "command_type": "command",
  "device_id": "C271111EC0AB",
  "parameter": "0,ff,50",
  "response": {},
  "summary": "Moved to 50% closed"
}

Turn device on or off

Turn a Bot, plug, light, fan, appliance or infrared remote's appliance on or off.

Inputs

Devicedevice_idtextRequired
The SwitchBot device or infrared remote. Pick one, or give its ID from an earlier step.
TurnpowertextRequired
On or off.One of: on, off.

Outputs

The command sent

commandtext
The command, such as turnOn, press or setPosition
command_typetext
command, or customize for a custom button
device_idtext
The device the command went to
parametertext
The command's parameter, default when it takes none
responseobject
Anything SwitchBot sent back, often empty
summarytext
What was done, in words
Example output
{
  "command": "turnOn",
  "command_type": "command",
  "device_id": "C271111EC0AB",
  "parameter": "default",
  "response": {},
  "summary": "Turned on"
}

On this page