tuya Device Control Cloud Services API Reference User Guide
- August 9, 2024
- Tuya
Table of Contents
- tuya Device Control Cloud Services API Reference
- Product Information
- Product Usage Instructions
- Get the instruction set by category
- Get the instruction set by device
- Get the instruction set by devices
- Specifications and properties of the device
- Send instructions to the device
- Get the latest device status
- Read User Manual Online (PDF format)
- Download This Manual (PDF format)
tuya Device Control Cloud Services API Reference
Product Information
The Device Control product provides a set of APIs and instructions for controlling devices remotely. Users can send instructions to the device using the provided API endpoints.
Specifications:
- Device Control
- Version: 20240124
- Online Version
Product Usage Instructions
-
Get the Instruction Set by Category:
Users can retrieve the instruction set by category using the following API endpoints:- API Description
- API Address
- Request Parameter
- Return Parameter
- Request Example
- SDK Example
- Response Example
- Error Code
-
Get the Instruction Set by Device:
To obtain the instruction set by the device, users can utilize the provided API endpoints for specific devices. This includes details such as API address, request parameters, return parameters, and examples. -
Get the Instruction Set by Devices:
This feature allows users to access the instruction set for multiple devices. Users can make requests using the API address and parameters provided. -
Get the Specifications and Properties of the Device:
This API endpoint provides detailed specifications and properties of the device, including the instruction set and status set. Users can request this information along with examples of how to use the SDK. -
Send Instructions to the Device:
Users can send specific instructions to the device using the provided API. This includes details such as request parameters, return parameters, and examples of how to send instructions effectively.
FAQ:
-
Q: How can I troubleshoot if I encounter errors when sending instructions?
A: If you encounter errors when sending instructions, refer to the error code section in the API documentation to identify and troubleshoot the issue. -
Q: Can I control multiple devices simultaneously?
A: Yes, you can control multiple devices simultaneously by utilizing the instructions set by the device feature and making requests for each device accordingly.
This topic describes the APIs related to device control, including getting instruction sets, specifications, properties, the latest statuses, and sending instructions.
Get the instruction set by category
API description
Query the instruction set by category. This instruction set has the biggest
amount of instructions in the category of all-in-one apps, which can be used
and referred to by developers. If you are a platform developer, you can
develop applications according to this instruction set.
API address
- GET /v1.0/ functions /{ category}
Request parameter
Return parameter
- Description of result
- | Parameter name | Category | Description |
- | :—| :—| :—|
- | category| String | Product category |
- | functions| List
| Instruction set |
- Description of functions
- | Parameter name | Category | Description |
- | :—| :—| :—|
- | code | String | Instruction | | type | String | Instruction type |
- | values | String | The range of input parameter values |
- | name | String | Instruction name |
- | desc | String | Description |
Request example
- GET /v1.0/ functions/kg
SDK example
Response example
Error code
The following are common service exceptions for this interface. For more
exception errors, see Error Code.
Get the instruction set by device
API description
Query the functions supported by the device. You can send control by the
obtained instructions.
API address
- GET /v1.0/ devices /{ device_id }/ functions
Request parameter
Return parameter
- Description of result
- | Parameter name | Category | Description |
- | :—| :—| :—|
- | category| String | Product category |
- | functions| List
| Instruction set |
- Description of functions
- | Parameter name | Category | Description |
- | :—| :—| :—|
- | code | String | Instruction |
- | type | String | Instruction type |
- | values | String | The range of input parameter values |
- | name | String | Instruction name |
- | desc | String | Description |
Request example
- GET /v1.0/ devices/vdevo155XXXX83954683/functions
SDK example
- TuyaClient client = new TuyaClient(clientId , secret , RegionEnum.CN);
- categoryFunctions = client.getFunctionsByDevId(DEV_ID);
- System.out.println(“Get the function list by device ID: “);
- System.out.println(JSONObject.toJSONString(category Functions));
Response example
Error code
The following are common service exceptions for this interface. For more
exception errors, see Error Code.
Get the instruction set by devices
API description
Query the functions supported by the devices List. You can send control by the
obtained instructions. support up to 20 devices
API address
- GET /v1.0/ devices/functions
Request parameter
Return parameter
- Description of result
- | Parameter name | Category | Description |
- | :—| :—| :—|
- | category| String | Product category |
- | functions| List
| Instruction set | - | devices | List | device Id List |
- Description of functions
- | Parameter name | Category | Description |
- | :—| :—| :—|
- | code | String | Instruction |
- | type | String | Instruction type |
- | values | String | The range of input parameter values |
- | name | String | Instruction name |
- | desc | String | Description |
Request example
- GET /v1.0/ devices/functions?device_ids =06200286 dc4f22c8418c ,6c8b eb2f
- a517fbc901dtln
SDK example
- TuyaClient client = new TuyaClient(clientId , secret , RegionEnum.CN);
- categoryFunctions = client.getFunctionsByDevsList(DEV_ID);
- System.out.println(“Get the function list by devices List: “);
- System.out.println(JSONObject.toJSONString(category Functions));
Response example
Error code
The following are common service exceptions for this interface. For more
exception errors, see Error Code.
Specifications and properties of the device
Get the specifications and properties of the device, including the instruction set and status set
API description
This interface is used to get the instruction set and status set supported by
the device according to the device ID.
API address
- GET /v1.0/ devices /{ device_id }/ specifications
Request parameter
Return parameter
- Description of result
- | Parameter name | Category | Description |
- | :—| :—| :—|
- | category | String | Product category |
- | functions | List
| Instruction set | - | status | List
| Status set |
- Description of functions
- | Parameter name | Category | Description |
- | :—- | :—- | :—|
- | code | String | command |
- | type | String | Type |
- | values | String | The range of parameter values |
- Description of status
- | Parameter name | Category | Description |
- | :—| :—| :—|
- | code | String | status code |
- | type | String | Type |
- | values | String | The range of parameter values |
Request example
- GET /v1.0/ devices/vdevoXXXXXXXXXXXXXXX/specifications
SDK example
N/A
Return parameter
Send instructions to the device
API description
This interface is used to send one or more obtained instruction sets. Whether
instruction sets can be sent simultaneously depends on the product.
API address
- POST /v1.0/ devices /{ device_id }/ commands
Request parameter
Return parameter
Request example
- POST /v1.0/ devices/vdevo1552XXXX3954683/commands
SDK example
Response example
Error code
The following are common service exceptions for this interface. For more
exception errors, see Error Code.
Get the latest device status
API description
Get the latest device status by the device ID
API address
- GET /v1.0/ devices /{ device_id }/ status
Request parameter
Return parameter
Request example
- GET /v1.0/ devices /{ device_id }/ status
SDK example
Response example
Error code
The following are common service exceptions for this interface. For more
exception errors, see Error Code.
Read User Manual Online (PDF format)
Read User Manual Online (PDF format) >>