Last Updated on : 2024-06-24 04:09:37download
```mermaid %%{init: { "sequence": { "wrap": true} } }%% sequenceDiagram title: Send Commands to Control Air Conditioner Actor User as User participant WeChat mini program as WeChat mini program participant Cloud as Cloud participant Universal IR remote control as Universal IR remote control participant IR device as IR device User->> WeChat mini program: Request supported brands WeChat mini program->>Cloud: -->>WeChat mini program: Return brands supported by specified device category User->>WeChat mini program: Request index list of IR code libraries supported by specified brands WeChat mini program->>Cloud: -->>WeChat mini program: Return index list of IR code libraries supported by specified brands User->>WeChat mini program: Choose an IR code library index to test whether a device can be controlled properly WeChat mini program->>Cloud: infrared.acTestCommand Cloud->>Universal IR remote control: Send IR code Universal IR remote control->>IR device: Send IR code IR device->>User: Confirm device control result User->>WeChat mini program: Confirm available IR code library index and bind remote control WeChat mini program->>Cloud: -->>WeChat mini program: Return remote_id of virtual remote control for controllable device User->>WeChat mini program: Control air conditioner with single command WeChat mini program->>Cloud: infrared.acCommand Cloud->>Universal IR remote control: Send IR code Universal IR remote control->>IR device: Send IR code User->>WeChat mini program: Control air conditioner with the scene command WeChat mini program->>Cloud: infrared.acScenesCommand Cloud->>Universal IR remote control: Send IR code Universal IR remote control->>IR device: Send IR code User->>WeChat mini program: Request current status of air conditioner WeChat mini program->>Cloud: -->>WeChat mini program: Return current status of air conditioner ```
Action | Description |
---|---|
infrared.categoryBrand | Get the list of brands supported by a specified device category. |
infrared.categoryBrandRemote | Get the list of default remote control indexes that are supported by the brands dedicated to a specified device category. |
infrared.acTestCommand | Control a device when pairing with remote control. |
infrared.addNormalRemote | Add a common remote control. |
infrared.acCommand | Control an air conditioner with a single command. |
infrared.acScenesCommand | Control an air conditioner with the scene command. |
infrared.acStatus | Query current status of an air conditioner. |
API description
Get information about brands that are supported by a device category dedicated to an IR remote control. TV sets and air conditioners are supported.
API endpoint
action: infrared.categoryBrand
Request parameter
Parameter name | Type | Description | Required |
---|---|---|---|
infrared_id | String | The infrared device ID. | Yes |
category_id | String | The device category ID. | Yes |
Sample request
{
"action": "infrared.categoryBrand",
"params": {
"infrared_id": "vdevo157924607038167",
"category_id": "2"
}
}
Response parameter
Parameter name | Type | Description |
---|---|---|
code | Integer | The response code. |
success | Boolean | Indicates whether the operation is successful. Valid values:true : success.false : failure. |
msg | String | The error message that is returned if the API call fails. This parameter value is empty if the API call succeeds. |
result | List | The returned result. |
Description of result
Parameter name | Type | Description |
---|---|---|
brand_id | String | The brand ID. |
brand_name | String | The name of the brand. |
Sample response
{
"success": true,
"result": [
{
"brand_id": "907",
"brand_name": "Denon"
},
{
"brand_id": "3080",
"brand_name": "ENVISION"
},
{
"brand_id": "472",
"brand_name": "Feilu"
},
{
"brand_id": "352",
"brand_name": "Optoma"
},
{
"brand_id": "2427",
"brand_name": "RICHINFO"
},
{
"brand_id": "232",
"brand_name": "SANYO"
},
{
"brand_id": "1216",
"brand_name": "Kaisui"
}
]
}
API description
Get the list of default remote control indexes that are supported by the brands dedicated to a specified device category.
API endpoint
action: infrared.categoryBrandRemote
Request parameter
Parameter name | Type | Description | Required |
---|---|---|---|
infrared_id | String | The infrared device ID. | Yes |
category_id | String | The device category ID. | Yes |
brand_id | String | The brand ID. | Yes |
Sample request
{
"action": "infrared.categoryBrandRemote",
"params": {
"infrared_id": "vdevo157924607038167",
"category_id": "2",
"brand_id": "907"
}
}
Response parameter
Parameter name | Type | Description |
---|---|---|
code | Integer | The response code. |
success | Boolean | Indicates whether the operation is successful. Valid values:true : success.false : failure. |
msg | String | The error message that is returned if the API call fails. This parameter value is empty if the API call succeeds. |
result | List | The returned result. |
Description of result
Parameter name | Type | Description |
---|---|---|
remote_index | String | The remote control index. |
Sample response
{
"success": true,
"result": [
{
"remote_index": "1092"
},
{
"remote_index": "1102"
},
{
"remote_index": "1107"
},
{
"remote_index": "1112"
},
{
"remote_index": "1117"
}
]
}
API description
Send a single command that is transmitted by a remote control button based on a remote control index to test whether the remote control matches the air conditioner.
API endpoint
action: infrared.acTestCommand
API description
The following table describes the IR instruction sets dedicated to air conditioners.
Parameter name | Type | Description | Required |
---|---|---|---|
power | Integer | The power status. Valid values:1 : On0 : Off |
No |
mode | Integer | The mode in which an air conditioner runs. Valid values:0 : cool mode1 : heat mode2 : auto mode3 : fan mode4 : dry mode |
Some air conditioners do not support all of these modes. |
temp | Integer | The temperature. Valid values: 16°C to 30°C. | No |
wind | Integer | The wind speed. Valid values:0 : automatic1 : low speed2 : medium speed3 : high speed |
Some air conditioners do not support all of these speed levels. |
Request parameter
Parameter name | Type | Parameter location | Description | Required |
---|---|---|---|---|
infrared_id | String | URI | The infrared device ID. | Yes |
remote_index | String | BODY | The remote control index. | Yes |
category_id | Integer | BODY | The device category ID. | Yes |
code | String | BODY | The DP code. Error code if the API call fails. For more information, see API description. | Yes |
value | Integer | BODY | The DP value to be sent. For more information, see API description. | Yes |
Response parameter
Parameter name | Type | Description |
---|---|---|
code | Integer | The response code. For more information, see the Error codes. |
success | Boolean | Indicates whether the operation is successful. Valid values:true : success.false : failure. |
msg | String | The error message that is returned if the API call fails. This parameter value is empty if the API call succeeds. |
result | Boolean | The returned result. |
Sample request
{
"action": "infrared.acTestCommand",
"params": {
"infrared_id": "vdevo157924607038167",
"remote_index":"7273",
"category_id": 5,
"code": "temp",
"value": 26
}
}
Sample response
{
"result": true,
"success": true,
"t": 1586501573398
}
API description
Add a common remote control that is inapplicable to set-top boxes and air conditioners.
API endpoint
action: infrared.addNormalRemote
Request parameter
Parameter name | Type | Description | Required |
---|---|---|---|
infrared_id | String | The infrared device ID. | Yes |
category_id | String | The device category ID. | Yes |
brand_id | String | The brand ID. | Yes |
brand_name | String | The name of the brand. | Yes |
remote_index | String | The remote control index. | Yes |
remote_name | String | The name of the remote control. | Yes |
Sample request
{
"action": "infrared.addNormalRemote",
"params": {
"infrared_id": "vdevo157924607038167",
"category_id": "2",
"category_name": "TV set",
"brand_id": "27",
"brand_name": "TCL",
"remote_index": "10982",
"remote_name" : "Name of remote control"
}
}
Response parameter
Parameter name | Type | Description |
---|---|---|
code | Integer | The response code. |
success | Boolean | Indicates whether the operation is successful. Valid values:true : success.false : failure. |
msg | String | The error message that is returned if the API call fails. This parameter value is empty if the API call succeeds. |
result | List | The returned result. |
Description of result
Parameter name | Type | Description | |
---|---|---|---|
remote_id | String | The device ID of the remote control. |
Sample response
{
"success": true,
"result": {
"remote_id": "6cb9e4eaf1e462b3d4ihh7"
}
}
API description
Send a single command to control an air conditioner.
API endpoint
action: infrared.acCommand
API description
Parameter name | Type | Description | Required |
---|---|---|---|
power | Integer | The power status. Valid values:1 : On0 : Off |
No |
mode | Integer | The mode in which an air conditioner runs. Valid values:0 : cool mode1 : heat mode2 : auto mode3 : fan mode4 : dry mode |
Some air conditioners do not support all of these modes. |
temp | Integer | The temperature. Valid values: 16°C to 30°C. | No |
wind | Integer | The wind speed. Valid values:0 : automatic1 : low speed2 : medium speed3 : high speed |
Some air conditioners do not support all of these speed levels. |
Request parameter
Parameter name | Type | Parameter location | Description | Required |
---|---|---|---|---|
infrared_id | String | URI | The infrared device ID. | Yes |
remote_id | String | URI | The remote control ID. | Yes |
code | String | BODY | The DP code to be sent. For more information, see API description. | Yes |
value | Integer | BODY | The DP value to be sent. For more information, see API description. | Yes |
Response parameter
Parameter name | Type | Description |
---|---|---|
code | Integer | The response code. For more information, see the Error codes. |
success | Boolean | Indicates whether the operation is successful. Valid values:true : success.false : failure. |
msg | String | The error message that is returned if the API call fails. This parameter value is empty if the API call succeeds. |
result | Boolean | The returned result. |
Sample request
{
"action": "infrared.acCommand",
"params": {
"infrared_id": "vdevo157924607038167",
"remote_id":"6c014f07yyyyyy",
"code": "temp",
"value": 26
}
}
Sample response on success
{
"result": true,
"success": true,
"t": 1586501573398
}
Sample response on failure
{
"code": 2050,
"msg": "The key code library does not exist.",
"success": false,
"t": 1586763590514
}
Error codes
The following table lists common error codes for the API calls. For more error codes, see Global Error Codes.
Error codes | Description |
---|---|
500 | A system error has occurred while processing your request. |
1109 | Invalid parameter. |
2050 | The key code library does not exist. |
API description
Send a command that specifies multiple conditions to control an air conditioner with a smart scene.
The combination of certain conditions does not match a key code library. Therefore, an error message will be returned to indicate that the key code library does not exist.
API endpoint
action: infrared.acScenesCommand
API description
Parameter name | Type | Description | Required |
---|---|---|---|
power | Integer | The power status. Valid values:1 : On0 : Off |
No |
mode | Integer | The mode in which an air conditioner runs. Valid values:0 : cool mode1 : heat mode2 : auto mode3 : fan mode4 : dry mode |
Some air conditioners do not support all of these modes. |
temp | Integer | The temperature. Valid values: 16°C to 30°C. | No |
wind | Integer | The wind speed. Valid values:0 : automatic1 : low speed2 : medium speed3 : high speed |
Some air conditioners do not support all of these speed levels. |
Request parameter
Parameter name | Type | Parameter location | Description | Required |
---|---|---|---|---|
infrared_id | String | URI | The infrared device ID. | Yes |
remote_id | String | URI | The remote control ID. | Yes |
power | Integer | BODY | The power status. Valid values:1 : On0 : Off |
Yes |
mode | Integer | BODY | The mode in which an air conditioner runs. Valid values:0 : cool mode1 : heat mode2 : auto mode3 : fan mode4 : dry mode |
No |
temp | Integer | BODY | The temperature. Valid values: 16°C to 30°C. | No |
wind | Integer | BODY | The wind speed. Valid values:0 : automatic0 : low speed2 : medium speed3 : high speed |
No |
Response parameter
Parameter name | Type | Description |
---|---|---|
code | Integer | The response code. For more information, see the Error codes. |
success | Boolean | Indicates whether the operation is successful. Valid values:true : success.false : failure. |
msg | String | The error message that is returned if the API call fails. This parameter value is empty if the API call succeeds. |
result | Boolean | The returned result. |
Sample request
{
"action": "infrared.acScenesCommand",
"params": {
"infrared_id": "vdevo157924607038167",
"remote_id":"6c014f07yyyyyy",
"power": 1,
"mode": 2,
"temp": 20,
"wind": 1
}
}
Sample response on success
{
"success": true,
"result": true
}
Sample response on failure
{
"code": 2050,
"msg": "The key code library does not exist.",
"success": false,
"t": 1586763590514
}
Error codes
The following table lists common error codes for the API calls. For more error codes, see Global Error Codes.
Error codes | Description |
---|---|
500 | A system error has occurred while processing your request. |
1109 | Invalid parameter. |
2050 | The key code library does not exist. |
API endpoint
action: infrared.acStatus
Request parameter
Parameter name | Type | Description | Required |
---|---|---|---|
infrared_id | String | The infrared device ID. | Yes |
remote_id | String | The remote control ID. | Yes |
Sample request
{
"action": "infrared.acStatus",
"params": {
"infrared_id": "vdevo157924607038167",
"remote_id": "6cb2fb33541a44967fxqhy"
}
}
Response parameter
Parameter name | Type | Description |
---|---|---|
code | Integer | The response code. |
success | Boolean | Indicates whether the operation is successful. Valid values:true : success.false : failure. |
msg | String | The message that is returned if the request failed. The response is empty if the request is successful. |
result | Object | The returned result. |
Description of result
Parameter name | Type | Description |
---|---|---|
mode | String | The mode in which the air conditioner runs. |
temp | String | The temperature. |
wind | String | The air speed. |
power | String | The power status. |
remote_id | String | The remote control ID. |
Sample response
{
"success": true,
"t": 1543927305251,
"result": {
"mode": "0",
"temp": "20",
"remote_id": "6cb2fb33541a44967fxqhy",
"wind": "3"
}
}
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback