Among all the interfaces open on the platform, issuing commands to devices is the most essential and frequently used command.
When first accessing the device, it is also recommended to implement the "Issuing commands to devices" first, and then implement other functions through other interfaces.

Before sending commands to the device, please make sure that the device is connected to the network and is displayed online in the console.
Preparation
Before starting to write code, please do the following preparations:
1 Registered and logged in to the platform and installed the "IoT console" module
2 The device is powered on, online, and can be controlled in the console
3 Download / install a similar interface request tool (if not)

4.1 Send command interface

Interface address:
https://api.thingboot.com/{AppID}/device/control/?sign={sign}&ts={ts}
{AppID} is your application ID (generated by the platform)Please enter the console, in the development settings page to view.
{sign} and {ts} algorithm, please see the description in the previous section
Request data:
{
	"device":820720,
	"order":{"temp":""}
}
Request method: POST; Data format: JSON
This command issues the command of to Smart AC Remote with ID 820720
For more configuration parameters, please refer to section4.2 "Product Supported Commands"below

When the parameters are relatively long, it is recommended to use the POST method.

Name Required Type Description
gateway No string
When sending a order to a device that must be forwarded by its associated gateway, you must specify the gateway’s device ID—the unique ID found on the gateway housing and in the management console. To include multiple gateways, separate their IDs with a comma (,) or vertical bar (|); up to five gateways can be specified at once.
device No string
Device ID, Unique Device ID (Found on the device housing and console) When specifying multiple devices, connect them with a separator (, or |).When specifying multiple devices, these devices do not need to belong to the same product category, but they must support the same command.
order No string
Command: JSON String (Recommended) or Direct Parameter Transmission Simple Commands: Can be sent via GET or POST directly in the format: Device Attribute Name=Attribute Value Complex or Long Commands: Please send via POST in the format: {"order":{"Command Content"}} In some business scenarios, it is necessary to carry specific information (e.g., order number) in the command.You can add an extra field to the order object. For example:{"power":1,"extra":"T25030700001"} This specific information will be returned as-is in the asynchronous message push corresponding to this command. Note: The extra field only supports uppercase/lowercase letters (a-zA-Z) and numbers (0-9), with a maximum length of 32 characters.

It should be noted that a status code of 200 only indicates that the platform has received a valid device ID and parameter name, and has successfully sent a command to the device.

However, the device may be offline, or there may be errors in the

Name Type Description
code int
200: Command issued successfully. 501: No Device ID specified. The Device ID must be a single integer, or multiple integers separated by "|" or ",". This ID is available in the Device List API and can also be viewed in the Device List section of this console. 502: Device does not exist or no available devices. All provided Device IDs are invalid. Please check if the Device IDs are correct and whether the devices have been deleted. 503: Excessive devices specified. A maximum of 100 Device IDs can be specified at one time. 504: Multiple Device IDs specified, but some are unavailable (non-existent, no permission, or deleted). 50xx: Please refer to "Global Error Codes".

4.2 Product supports commands

4.2.1 产品命令
Command Name Content Description
power open {"power":"1"}
close {"power":"0"}
mode Auto {"mode":"auto"}
Cool {"mode":"cool"}
Heat {"mode":"heat"}
Dry {"mode":"dry"}
Fan {"mode":"fan"}
degree 16℃ {"degree":"16"}
17℃ {"degree":"17"}
18℃ {"degree":"18"}
19℃ {"degree":"19"}
20℃ {"degree":"20"}
21℃ {"degree":"21"}
22℃ {"degree":"22"}
23℃ {"degree":"23"}
24℃ {"degree":"24"}
25℃ {"degree":"25"}
25.5℃ {"degree":"25.5"}
26℃ {"degree":"26"}
27℃ {"degree":"27"}
28℃ {"degree":"28"}
29℃ {"degree":"29"}
30℃ {"degree":"30"}
31℃ {"degree":"31"}
speed Auto {"speed":"0"}
1 {"speed":"1"}
2 {"speed":"2"}
3 {"speed":"3"}
4 {"speed":"4"}
5 {"speed":"5"}
6 {"speed":"6"}
swing All {"swing":"1"}
Swing Left/Right {"swing":"h"}
Swing Up/Down {"swing":"v"}
Stop {"swing":"0"}
beep Open {"beep":"1"}
Close {"beep":"0"}
light Open {"light":"1"}
Close {"light":"0"}
4.2.2 System command
Command Name Content Description
system GetNetworkInfo network
Get device status state
Connect WiFi wifi_connect
Connect to configured WiFi wifi_connect_multi
Disconnect WiFi wifi_disconnect
Enter private deployment mode
(If configured)
private
Reboot restart

4.3 Call code example

Programming way: