Device Control

Last Updated on : 2021-07-16 07:39:55download

Control devices by user ID, device ID, control command, and command value.

API address

POST: /v1.0/iot-01/voice/users/{uid}/devices/{device_id}/commands

Request parameter

Parameter name Type IN Required Description
device_id String uri true The device ID.
uid String uri true The user ID.

Description of body

Parameter name Type IN Required Description
interface_name String true The name of the API to be queried.
command String true The command code.
value String true The command value.

Return parameter

Parameter name Type Description
result Object The returned result.
success Boolean Indicates whether the operation is successful. true: succeeded. false: failed.
t Long The returned 13-bit timestamp.
code Integer The response code. It is empty on success.
msg String The error message that is returned if the request fails. It is empty on success.

Description of result

Parameter name Type Description
message_id String The request identifier.
version String The version number.

Request example

POST: /v1.0/iot-01/voice/users/ay1618816013155*****/devices/vdevo1620380207*****/commands
{ "interface_name": "Tuya.SmartHome.PowerstateController", "command": "TurnOff", "value": "off" }

Return example

{ "result": { "message_id": "fa84349a-1701-464a-af1f-45d5e5607032" }, "t": 1620463296244, "success": true }

Error code

For more information, see error code.