English
English
简体中文
Contact Us
Register
Log In
Language
English
English
简体中文
Contact Us
Log In
Register
Go to main website
App Develop

App Development

Tuya provides multiple mobile app development methods such as no-code or IoT App SDK development to maximize the monetization of IoT apps.
layoutIndex

Send commands

Last Updated on : 2022-01-17 08:51:51download

Send commands to a device.

API address

POST: /v1.0/iot-03/devices/{device_id}/commands

Request parameter

Parameter nameTypeINRequiredDescription
device_idStringuritrueDevice ID

Description of body

Parameter nameTypeINRequiredDescription
commandsList trueThe command to control a device

Description of commands

Parameter nameTypeINRequiredDescription
codeString trueCommand code
valueObject trueCommand value

Return parameter

Parameter nameTypeDescription
resultBoolean

Request example

POST: /v1.0/iot-03/devices/xxxid/commands
{
  "commands": [
    {
      "code": "switch_led",
      "value": true
    }
  ]
}

Return example

{
    "result": true,
    "t": 1551851043862,
    "success": true
}

Error code

For more information, see error code.