Last Updated on : 2023-07-18 10:19:40download
Request method |
API | Description |
---|---|---|
GET | /v1.1/homes/{home_id}/scenes | Query scenes in a home |
GET | /v1.0/scenes/default-pictures | Query default scene images |
POST | /v1.0/homes/{home_id}/scenes/{scene_id}/trigger | Trigger a scene |
POST | /v1.0/homes/{home_id}/scenes | Add a scene |
DELETE | /v1.0/homes/{home_id}/scenes/{scene_id} | Delete a scene |
PUT | /v1.0/homes/{home_id}/scenes/{scene_id} | Modify a scene |
GET | /v1.0/homes/{home_id}/scene/devices | Query devices that support scenes in a home |
GET | /v1.0/devices/{device_id}/enable-linkage/codes | Get supported linkage conditions |
POST | /v1.0/devices/{device_id}/scenes/{scene_id} | Bind a scene |
DELETE | /v1.0/devices/{device_id}/scenes/{scene_id} | Unbind a scene |
GET | /v1.0/devices/{device_id}/scenes | Query scenes bound with a device |
POST | /v1.0/homes/{home_id}/automations | Add an automation scene |
PUT | /v1.0/homes/{home_id}/automations /{automation_id} |
Modify an automation scene |
DELETE | /v1.0/homes/{home_id}/automations /{automation_id} |
Delete an automation scene |
GET | /v1.1/homes/{home_id}/automations | Query automation scenes |
GET | /v1.0/homes/{home_id}/automations /{automation_id} |
Query an automation scene in a home |
POST | /v1.0/homes/{home_id}/automations /{automation_id}/conditions/trigger |
Query external conditions triggering an automation scene in a home |
GET | /v1.0/homes/{home_id}/automation /devices |
Query devices that support an automation scene in a home |
GET | /v1.0/homes/automation/weather/conditions | Query weather conditions supported by an automation scene |
GET | /v1.0/homes/{home_id}/enable-linkage/codes | Query actions supported in a home |
PUT | /v1.0/homes/{home_id}/automations /{automation_id}/actions/enable |
Enable an automation scene |
PUT | /v1.0/homes/{home_id}/automations /{automation_id}/actions/disable |
Disable an automation scene |
Query a list of scenes in the specified home.
GET /v1.1/homes/{home_id}/scenes
Parameter | Type | Parameter type | Description | Required |
---|---|---|---|---|
home_id | Long | URI | The home ID. | Yes |
Parameter | Type | Description |
---|---|---|
code | Integer | The response code. For more information, see Global Error Codes. |
success | Boolean | Indicates whether the operation is successful. Valid values:
|
msg | String | The error message that is returned if the API call fails. This parameter value is empty if the API call succeeds. |
result | Object | The returned result. |
Result
Parameter | Type | Description |
---|---|---|
scene_id | String | The scene ID. |
name | String | The scene name. |
background | String | The background image. |
enabled | Boolean | Indicates whether it is enabled. |
status | String | The status. Valid values:
|
actions | List | A list of actions. |
Actions
Parameter | Type | Description |
---|---|---|
entity_id | String | The device ID. |
executor_property | JSON | The property of the specified execution action. |
action_executor | String | The type of action. Valid value: dpIssue . |
GET /v1.1/homes/5270711/scenes
{
"success":true,
"t":1541071460239,
"result":[
{
"scene_id":"53IYSXI3gEn2w***",
"enabled": true,
"status":"1",
"name":"Turn on light bulb",
"background":"https://images.tuyacn.com/smart/rule/cover/starry.png",
"actions":[
{
"entity_id":"0120090568c63a89****",
"executor_property":{
"work_mode":"scene_2"
},
"action_executor":"dpIssue"
}
]
},
{
"scene_id":"DKgx28KbdPfz****",
"name":"Morning",
"background":"https://images.tuyacn.com/smart/rule/cover/****.png",
"actions":[
{
"entity_id":"012000715ccf7f4f****",
"executor_property":{
"switch_led":true
},
"action_executor":"dpIssue"
}
]
}
]
}
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. |
1106 | Invalid permission. |
Query a list of default scene images.
GET /v1.0/scenes/default-pictures
Parameter | Type | Description |
---|---|---|
code | Integer | The response code. For more information, see Global Error Codes. |
success | Boolean | Indicates whether the operation is successful. Valid values:
|
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 | A list of returned URLs of scene images. |
GET /v1.0/scenes/default-pictures
{
"success":true,
"t":1541071460239,
"result":[
"https://images.tuyacn.com/smart/rule/cover/starry.png",
"https://images.tuyacn.com/smart/rule/cover/sport.png"
]
}
The following table lists common error codes for the API calls. For more error codes, see Global Error Codes.
Error code | Description |
---|---|
500 | A system error has occurred while processing your request. |
1106 | Invalid permission. |
Trigger and run the specified scene.
POST /v1.0/homes/{home_id}/scenes/{scene_id}/trigger
Parameter | Type | Parameter type | Description | Required |
---|---|---|---|---|
home_id | Long | URI | The home ID. | Yes |
scene_id | String | URI | The scene ID. | Yes |
Parameter | Type | Description |
---|---|---|
code | Integer | The response code. For more information, see Global Error Codes. |
success | Boolean | Indicates whether the operation is successful. Valid values:
|
msg | String | The error message that is returned if the API call fails. This parameter value is empty if the API call succeeds. |
result | Object | Indicates whether the scene is triggered successfully. true is returned when the operation is successful. |
POST /v1.0/homes/242****/scenes/53IYSXI3gEn2w3Oc/trigger
{
"success": true,
"t": 1541072348540,
"result": true
}
The following table lists common error codes for the API calls. For more error codes, see Global Error Codes.
Error code | Description |
---|---|
500 | A system error has occurred while processing your request. |
1106 | Invalid permission. |
Delete a scene of the specified home.
DELETE /v1.0/homes/{home_id}/scenes/{scene_id}
Parameter | Type | Parameter type | Description | Required |
---|---|---|---|---|
home_id | Long | URI | The home ID. | Yes |
scene_id | String | URI | The scene ID. | Yes |
Parameter | Type | Description |
---|---|---|
code | Integer | The response code. For more information, see Global Error Codes. |
success | Boolean | Indicates whether the operation is successful. Valid values:
|
msg | String | The error message that is returned if the API call fails. This parameter value is empty if the API call succeeds. |
result | Object | Indicates whether the scene is deleted successfully. true is returned when the operation is successful. |
DELETE /v1.0/homes/242****/scenes/53IYSXI3gEn2****
{
"success": true,
"t": 1541072348540,
"result": true
}
The following table lists common error codes for the API calls. For more error codes, see Global Error Codes.
Error code | Description |
---|---|
500 | A system error has occurred while processing your request. |
1106 | Invalid permission. |
Add a scene under the specified home.
POST /v1.0/homes/{home_id}/scenes
Parameter | Type | Parameter type | Description | Required |
---|---|---|---|---|
home_id | String | URI | The home ID. | Yes |
name | String | Body | The scene name. | Yes |
background | String | Body | The background image. | Yes |
actions | List | Body | A list of actions. | Yes |
Description of devices involved in actions
Parameter | Type | Description | Required |
---|---|---|---|
entity_id | String | The device ID. | Yes |
executor_property | JSON | The property of the specified execution action. | No |
action_executor | String | The type of the specified execution action. | Yes |
Description of actions
Device actions
entity_id
: the device ID.action_executor
: dpIssue
.executor_property
: standard instruction.Delayed action
entity_id
: the device ID.action_executor
: delay
.executor_property
: the delay parameter.Disable an automation scene
entity_id
: the ID of an automation scene.action_executor
: ruleDisable
.executor_property
: leave this field empty.Enable an automation scene
entity_id
: the ID of an automation scene.action_executor
: ruleEnable
.executor_property
: leave this field empty.Parameter | Type | Description |
---|---|---|
code | Integer | The response code. For more information, see Global Error Codes. |
success | Boolean | Indicates whether the operation is successful. Valid values:
|
msg | String | The error message that is returned if the API call fails. This parameter value is empty if the API call succeeds. |
result | Object | The scene ID. |
POST /v1.0/homes/242****/scenes
{
"name": "Test of Adding a Scene",
"background":"https://images.tuyacn.com/smart/rule/cover/sport.png",
"actions":[
{
"executor_property":{
"hours":"0",
"minutes": "0",
"seconds": "5"
},
"action_executor":"delay"
},
{
"executor_property":{
"work_mode":"scene_2"
},
"action_executor":"dpIssue",
"entity_id":"0120090568c63a89****"
},
{
"action_executor": "ruleDisable",
"entity_id": "AYJV2hh3eqm3****"
},
{
"action_executor": "ruleEnable",
"entity_id": "AYJV2hh3eqm3****"
}
]
}
{
"success": true,
"t": 1541072348540,
"result":"53IYSXI3gEn2****"
}
The following table lists common error codes for the API calls. For more error codes, see Global Error Codes.
Error code | Description |
---|---|
500 | A system error has occurred while processing your request. |
1106 | Invalid permission. |
Modify a scene under the specified home.
PUT /v1.0/homes/{home_id}/scenes/{scene_id}
Parameter | Type | Parameter type | Description | Required |
---|---|---|---|---|
home_id | Long | URI | The home ID. | Yes |
scene_id | String | Body | The scene ID. | Yes |
name | String | Body | The scene name. | Yes |
background | String | Body | The background image. | Yes |
actions | List | Body | A list of actions. | Yes |
Description of devices involved in actions
Parameter | Type | Description | Required |
---|---|---|---|
entity_id | String | The device ID. | Yes |
executor_property | JSON | The property of the specified execution action. | Yes |
action_executor | String | The type of action. Valid value: dpIssue . |
Yes |
Description of delay in actions
Parameter | Type | Description | Required |
---|---|---|---|
executor_property | JSON | The property of the specified execution action. | Yes |
action_executor | String | The type of action. Valid value: delay . |
Yes |
Parameter | Type | Description |
---|---|---|
code | Integer | The response code. For more information, see Global Error Codes. |
success | Boolean | Indicates whether the operation is successful. Valid values:
|
msg | String | The error message that is returned if the API call fails. This parameter value is empty if the API call succeeds. |
result | Object | true is returned when the operation is successful. |
PUT /v1.0/homes/242****/scenes/53IYSXI3gEn2****
{
"name": "Test of Adding a Scene",
"background":"https://images.tuyacn.com/smart/rule/cover/sport.png",
"actions":[
{
"executor_property":{
"hours":"0",
"minutes":"0",
"seconds":"5"
},
"action_executor":"delay"
},
{
"executor_property":{
"work_mode":"scene_2"
},
"action_executor":"dpIssue",
"entity_id":"0120090568c63a89****"
}
]
}
{
"success": true,
"t": 1541072348540,
"result": true
}
The following table lists common error codes for the API calls. For more error codes, see Global Error Codes.
Error code | Description |
---|---|
500 | A system error has occurred while processing your request. |
1106 | Invalid permission. |
Query a list of devices that support scenes in the specified home.
GET /v1.0/homes/{home_id}/scene/devices
Parameter | Type | Parameter type | Description | Required |
---|---|---|---|---|
home_id | Long | URI | The ID of the user’s home. | Yes |
Parameter | Type | Description |
---|---|---|
code | Integer | The response code. For more information, see Global Error Codes. |
success | Boolean | Indicates whether the operation is successful. Valid values:
|
msg | String | The message that is returned if the request fails. It is empty if the request is successful. |
t | Long | The returned 13-digit timestamp. |
result | List | The returned result. |
Result
Parameter | Type | Description |
---|---|---|
device_id | String | The device ID. |
uuid | String | The universally unique identifier (UUID) of the specified device. |
name | String | The name. |
home_id | String | The home ID. |
product_id | String | The product ID. |
GET /v1.0/homes/2422121/scene/devices
{
"result":[
{
"id":"vedo123****",
"uuid":"asdfghnbvcx****",
"name":"Test Device",
"product_id":"r4567543****",
"home_id":"242****"
}
],
"success":true,
"t":1572936751228
}
{
"success": false,
"code": 1100,
"msg": "param is empty",
"t": 1540954683193
}
This API applies to scene switch devices. The scene switches have corresponding switch buttons, and each switch button has the specified instructions. With this API operation, the specified switch instruction can be bound with a sceneThis way, the scene switch is associated with the scene. Then, the scene can be directly triggered after an instruction is sent in the API request.
POST /v1.0/devices/{device_id}/scenes/{scene_id}
Parameter | Type | Parameter type | Description | Required |
---|---|---|---|---|
scene_id | String | URI | The scene ID. | Yes |
device_id | String | URI | The device ID. | Yes |
code | String | Body | The code of a standard instruction. | Yes |
value | String | BODY | The input parameter range of the specified instruction. | Yes |
Parameter | Type | Description |
---|---|---|
code | Integer | The response code. For more information, see Global Error Codes. |
success | Boolean | Indicates whether the operation is successful. Valid values:
|
msg | String | The error message that is returned if the API call fails. This parameter value is empty if the API call succeeds. |
result | Long | The room ID indicated by room_id . |
Result
Parameter | Type | Description |
---|---|---|
Success | Boolean | Indicates whether the operation is successful. |
POST /v1.0/devices/vdevo1575XXXX00013095/scenes/EqFkQ79XXXXXtjlkTm
{
"code":"scene_1",
"value":"scene"
}
{
"result": {
"success": true
},
"success": true,
"t": 1575972372805
}
The following table lists common error codes for the API calls. For more error codes, see Global Error Codes.
Error code | Description |
---|---|
500 | A system error has occurred while processing your request. |
1106 | Invalid permission. |
This API applies to scene switch devices. After binding, a switch in the scene switch can be unbound from the specified scene.
DELETE /v1.0/devices/{device_id}/scenes/{scene_id}
Parameter | Type | Parameter type | Description | Required |
---|---|---|---|---|
device_id | String | URI | The device ID. | Yes |
scene_id | String | URI | The scene ID. | Yes |
code | String | BODY | The code of a standard instruction. This value corresponds with the scene switch button. | Yes |
Parameter | Type | Description |
---|---|---|
code | Integer | The response code. For more information, see Global Error Codes. |
success | Boolean | Indicates whether the operation is successful. Valid values:
|
msg | String | The error message that is returned if the API call fails. This parameter value is empty if the API call succeeds. |
result | Long | The room ID indicated by room_id . |
Result
Parameter | Type | Description |
---|---|---|
Success | Boolean | Indicates whether the operation is successful. |
DELETE /v1.0/devices/vdevo1575XXXX00013095/scenes/EqFkQ79XXXXXtjlkTm
{
"code":"scene_1"
}
{
"result": {
"success": true
},
"success": true,
"t": 1575972372805
}
The following table lists common error codes for the API calls. For more error codes, see Global Error Codes.
Error code | Description |
---|---|
500 | A system error has occurred while processing your request. |
1106 | Invalid permission. |
This API applies to scene switch devices. Query a list of scenes bound with the specified device based on the ID of the scene switch device.
GET /v1.0/devices/{device_id}/scenes
Parameter | Type | Parameter type | Description | Required |
---|---|---|---|---|
device_id | String | URI | The device ID. | Yes |
Parameter | Type | Description |
---|---|---|
code | Integer | The response code. For more information, see Global Error Codes. |
success | Boolean | Indicates whether the operation is successful. Valid values:
|
msg | String | The error message that is returned if the API call fails. This parameter value is empty if the API call succeeds. |
result | Long | The room ID indicated by room_id . |
Result
Parameter | Type | Description |
---|---|---|
device_id | Boolean | The device ID. |
scenes | Object | A list of scenes bound with the device. |
Scenes
Parameter | Type | Description |
---|---|---|
scene_id | String | The scene ID. |
name | String | The scene name. |
code | String | The binding instruction. This field applies to scene switch devices. Each switch corresponds with a standard instruction. |
value | Object | The input parameter range of the specified instruction. |
GET /v1.0/devices/vdevo15758XXXX13095/scenes
{
"result": {
"device_id": "vdevo15758****13095",
"scenes": [
{
"code": "scene_2",
"name": "Test of Adding Scene G-Turn off Light",
"scene_id": "ilCZllmbXXXPO***",
"value": "scene"
},
{
"code": "scene_1",
"name": "Scene of Turning on Light",
"scene_id": "EqFkQ79uXXXjl***",
"value": "scene"
}
]
},
"success": true,
"t": 1576036860284
}
The following table lists common error codes for the API calls. For more error codes, see Global Error Codes.
Error code | Description |
---|---|
500 | A system error has occurred while processing your request. |
1106 | Invalid permission. |
Add an automation scene to the specified home.
POST /v1.0/homes/{home_id}/automations
Parameter | Type | Parameter type | Description | Required |
---|---|---|---|---|
home_id | Long | URI | The ID of the user’s home. | Yes |
name | String | Body | The name of the specified automation scene. | Yes |
background | String | Body | The background image. | Yes |
conditions | List | Body | A list of scene conditions. | Yes |
actions | List | Body | A list of actions. | Yes |
match_type | Integer | Body | Indicates the matching types. Valid values:
|
Yes |
condition_rule | String | String | Custom condition rules. This parameter is required when the value of match_type is 3 . The custom condition rules follow the AND OR formula. Each automation condition is identified by its order_num . |
No |
preconditions | List | Body | The preconditions with the highest priority. | No |
Note: For example,
order_num
incondition_rule
is 1, 2, and 3 in turn. The business scenario is as follows: If you want to trigger an automation scene when conditions 1 and 2 are met simultaneously, or when condition 3 is met, then the expression is1&&2||3
.
Conditions
Parameter | Type | Description | Required |
---|---|---|---|
entity_type | Integer | The type of condition. The following condition types are supported:
|
Yes |
display | JSON | Shows the conditions. | Yes |
order_num | Integer | The serial number of the specified condition, starting from 1. | Yes |
entity_id | String | The ID of the specified entity that executes the action. Valid values:
|
No |
Display device status conditions
Parameter | Type | Description | Required |
---|---|---|---|
code | String | The statusCode of the specified device. |
Yes |
operator | String | The operator. For more information, see Mapping between code data types and operators. | Yes |
value | String | The value of the specified code. | Yes |
Display external conditions
Parameter | Type | Description | Required |
---|---|---|---|
code | String | The key of the specified external condition. | Yes |
operator | String | The operator. For more information, see Mapping between code data types and operators. | Yes |
value | Object | The code value for the key of the specified external condition. | Yes |
Display weather conditions
Parameter | Type | Description | Required |
---|---|---|---|
code | String | The key of the specified weather condition. For example, temp . |
Yes |
operator | String | The operator. For more information, see Mapping between code data types and operators. | Yes |
value | String | The code value for the key of the specified weather condition. | Yes |
Display scheduled task conditions
Parameter | Type | Description | Required |
---|---|---|---|
date | String | The date when a scheduled task is triggered, in the format of yyyyMMdd . For example, 20191125 . |
Yes |
loops | String | A seven-digit number consisting of 0 and 1. 0 means disabled and 1 means enabled. The first digit represents Sunday and the other digits represent Monday to Saturday sequentially. For example, 0011000 represents a scheduled task is executed every Tuesday and Wednesday. |
Yes |
time | String | The time when a scheduled task is triggered, in the format of 24-hour time. For example, 14:00 . |
Yes |
timezone_id | String | The time zone ID. For example, Asia/Shanghai . |
Yes |
Description of preconditions
The preconditions. You can set the specified time period as a precondition.
Parameter | Type | Description | Required |
---|---|---|---|
cond_type | String | Currently, you can only set the specified time period as a precondition. Valid value: timeCheck . |
Yes |
display | JSON | Shows the conditions. | Yes |
Description of display in preconditions
Parameter | Type | Description | Required |
---|---|---|---|
start | String | The start time in the format of 24-hour time. The default value is a time point of the day. For example, 10:00 . |
Yes |
end | String | The end time in the format of 24-hour time. For example, 22:00 . |
Yes |
loops | String | A seven-digit number consisting of 0 and 1. 0 means disabled and 1 means enabled. The first digit represents Sunday and the other digits represent Monday to Saturday sequentially. For example, 0011000 represents a scheduled task is executed every Tuesday and Wednesday. |
Yes |
timezone_id | String | The time zone ID. For example, Asia/Shanghai . |
Yes |
Description of actions
Parameter | Type | Description | Required |
---|---|---|---|
entity_id | String | The device ID. | Yes |
executor_property | JSON | The property of the specified execution action. | No |
action_executor | String | The type of the specified execution action. | Yes |
Device actions
entity_id
: the device ID.action_executor
: dpIssue
.executor_property
: standard instruction.Disable an automation scene
entity_id
: the ID of an automation scene.action_executor
: ruleDisable
.executor_property
: leave this field empty.Enable an automation scene
entity_id
: the ID of an automation scene.action_executor
: ruleEnable
.executor_property
: leave this field empty.Trigger a scene
entity_id
: the scene ID.action_executor
: ruleTrigger
executor_property
: leave this field empty.POST /v1.0/homes/242****/automations
{
"conditions":[
{
"display":{
"code":"switch_1",
"operator":"==",
"value":true
},
"entity_id":"vdevo15725982542****",
"entity_type":1,
"order_num":1
}
],
"actions":[
{
"action_executor":"delay",
"executor_property":{
"hours": "0",
"minutes": "0",
"seconds": "5"
}
},
{
"action_executor":"dpIssue",
"entity_id":"vdevo15725982542****",
"executor_property":{
"switch_1": true
}
}
],
"background":"https://images.tuyacn.com/smart/rule/cover/bedroom.png",
"match_type":1,
"name":"Automation Test",
}
Example of preconditions
{
"preconditions":[
{
"display":{
"start":"10:00",
"end":"12:00",
"loops":"0010000",
"timezone_id":"Asia/Shanghai"
},
"cond_type":"timeCheck"
}
]
}
Example of device status conditions
{
"conditions":[
{
"display":{
"code":"switch_1",
"operator":"==",
"value":true
},
"entity_id":"vdevo15725982542****",
"entity_type":1,
"order_num":1
}
]
}
Example of external conditions
{
"conditions":[
{
"display":{
"code":"test",
"operator":"==",
"value":"test"
},
"entity_type":15,
"order_num":1
}
]
}
Example of weather conditions
{
"conditions":[
{
"display":{
"code":"temp",
"operator":"==",
"value":"20"
},
"entity_id":"10",
"entity_type":3,
"order_num":1
}
]
}
Example of scheduled task conditions
{
"conditions":[
{
"display":{
"date":"20200301",
"loops":"0000000",
"time":"14:00",
"timezone_id":"Asia/Shanghai"
},
"entity_id":"timer",
"entity_type":6,
"order_num":1
}
]
}
Example of external actions
{
"actions":[
{
"action_executor":"externalAction",
"executor_property":{
// Custom, to be pushed through the message queue
}
}
]
}
Mapping between code data types and operators
type | operator |
---|---|
Boolean | “==” |
Integer | “>”,“==”,“<” |
Enum | “==” |
Parameter | Type | Description |
---|---|---|
code | Integer | The response code. For more information, see Global Error Codes. |
success | Boolean | Indicates whether the operation is successful. Valid values:
|
msg | String | The message that is returned if the request fails. It is empty if the request is successful. |
t | Long | The returned 13-digit timestamp. |
result | String | The ID of the specified automation scene. |
{
"success": true,
"t": 1541072348540,
"result":"53IYSXI3gEn2w3Oc"
}
{
"success": false,
"code": 1100,
"msg": "param is empty",
"t": 1540954683193
}
Modify automation scene configurations of the specified home.
PUT /v1.0/homes/{home_id}/automations/{automation_id}
Parameter | Type | Parameter type | Description | Required |
---|---|---|---|---|
home_id | Long | URI | The ID of the user’s home. | Yes |
automation_id | String | URI | The ID of the specified automation scene. | Yes |
name | String | Body | The name of the specified automation scene. | Yes |
background | String | Body | The background image. | Yes |
conditions | List | Body | A list of scene conditions. | Yes |
actions | List | Body | A list of actions. | Yes |
match_type | Integer | Body | Indicates the matching types. Valid values:
|
Yes |
condition_rule | String | String | The custom condition rule. This parameter is required when the value of match_type is 3 . The custom condition rules follow the AND OR formula. Each automation condition is identified by its order_num . |
No |
preconditions | List | Body | The preconditions with the highest priority. | No |
Note: For example,
order_num
incondition_rule
is 1, 2, and 3 in turn. The business scenario is as follows: If you want to trigger an automation scene when conditions 1 and 2 are met simultaneously, or when condition 3 is met, then the expression is1&&2||3
.
Conditions
Parameter | Type | Description | Required |
---|---|---|---|
entity_type | Integer | The type of condition. The following condition types are supported:
|
Yes |
display | JSON | Shows the conditions. | Yes |
order_num | Integer | The serial number of the specified condition, starting from 1 . |
Yes |
entity_id | String | The ID of the specified entity that executes the action. Valid values:
|
No |
Display device status conditions
Parameter | Type | Description | Required |
---|---|---|---|
code | String | The statusCode of the specified device. |
Yes |
operator | String | The operator. For more information, see Mapping between code data types and operators. | Yes |
value | String | The value of the specified code. | Yes |
Display external conditions
Parameter | Type | Description | Required |
---|---|---|---|
code | String | The key of the specified external condition. | Yes |
operator | String | The operator. For more information, see Mapping between code data types and operators. | Yes |
value | Object | The code value for the key of the specified external condition. | Yes |
Display weather conditions
Parameter | Type | Description | Required |
---|---|---|---|
code | String | The key of the specified weather condition. For example, temp . |
Yes |
operator | String | The operator. For more information, see Mapping between code data types and operators. | Yes |
value | String | The code value for the key of the specified weather condition. | Yes |
Display scheduled task conditions
Parameter | Type | Description | Required |
---|---|---|---|
date | String | The date when a scheduled task is triggered, in the format of yyyyMMdd . For example, 20191125 . |
Yes |
loops | String | A seven-digit number consisting of 0 and 1 . 0 means disabled and 1 means enabled. The first digit represents Sunday and the other digits represent Monday to Saturday sequentially. For example, 0011000 represents a scheduled task is executed every Tuesday and Wednesday. |
Yes |
time | String | The trigger time in the format of 24-hour time. For example, 14:00 . |
Yes |
timezone_id | String | The time zone ID. Fo example, Asia/Shanghai . |
Yes |
Description of preconditions
The preconditions. You can set the specified time period as a precondition.
Parameter | Type | Description | Required |
---|---|---|---|
cond_type | String | Currently, you can only set the specified time period as a precondition. Valid value: timeCheck . |
Yes |
display | JSON | Shows the conditions. | Yes |
Description of display in preconditions
Parameter | Type | Description | Required |
---|---|---|---|
start | String | The start time in the format of 24-hour time. The default value is a time point of the day. For example, 10:00 . |
Yes |
end | String | The end time in the format of 24-hour time. For example, 22:00 . |
Yes |
loops | String | A seven-digit number consisting of 0 and 1 . 0 means disabled and 1 means enabled. The first digit represents Sunday and the other digits represent Monday to Saturday sequentially. For example, 0011000 represents a scheduled task is executed every Tuesday and Wednesday. |
Yes |
timezone_id | String | The time zone ID. For example, Asia/Shanghai . |
Yes |
Description of devices involved in actions
Parameter | Type | Description | Required |
---|---|---|---|
entity_id | String | The device ID. | Yes |
executor_property | JSON | The property of the specified execution action. | Yes |
action_executor | String | The type of action. Valid value: dpIssue . |
Yes |
Description of external actions
Parameter | Type | Description | Required |
---|---|---|---|
executor_property | JSON | A custom external action. | Yes |
action_executor | String | The type of action. Valid value: externalAction . |
Yes |
Description of delay in actions
Parameter | Type | Description | Required |
---|---|---|---|
executor_property | JSON | The property of the specified execution action. | Yes |
action_executor | String | The type of action. Valid value: delay . |
Yes |
PUT /v1.0/homes/242****/automations/53IYSXI3gEn2w3Oc
{
"actions":[
{
"action_executor":"delay",
"executor_property":{
"hours":"0",
"minutes": "0",
"seconds": "5"
}
},
{
"action_executor":"dpIssue",
"entity_id":"vdevo15725982542****",
"executor_property":{
"switch_1":true
}
},
{
"action_executor":"externalAction",
"executor_property":{
// Subject to your customization
}
}
],
"background":"https://images.tuyacn.com/smart/rule/cover/bedroom.png",
"conditions":[
{
"display":{
"code":"switch_1",
"operator":"==",
"value":true
},
"entity_id":"vdevo15725982542****",
"entity_type":1,
"order_num":1
},
{
"display":{
"code":"mode",
"operator":"==",
"value":1
},
"entity_type":15,
"order_num":2
}
],
"match_type":1,
"name":"Automation Test",
}
Example of preconditions
{
"preconditions":[
{
"display":{
"start":"10:00",
"end":"12:00",
"loops":"0000000",
"timezone_id":"Asia/Shanghai"
},
"cond_type":"timeCheck"
}
]
}
Example of device status conditions
{
"conditions":[
{
"display":{
"code":"switch_1",
"operator":"==",
"value":true
},
"entity_id":"vdevo15725982542****",
"entity_type":1,
"order_num":1
}
]
}
Example of external conditions
{
"conditions":[
{
"display":{
"code":"test",
"operator":"==",
"value":"test"
},
"entity_type":15,
"order_num":1
}
]
}
Example of weather conditions
{
"conditions":[
{
"display":{
"code":"temp",
"operator":"==",
"value":"20"
},
"entity_id":"10",
"entity_type":3,
"order_num":1
}
]
}
Example of scheduled task conditions
{
"conditions":[
{
"display":{
"date":"20200301",
"loops":"0000000",
"time":"14:00",
"timezone_id":"Asia/Shanghai"
},
"entity_id":"timer",
"entity_type":6,
"order_num":1
}
]
}
Example of external actions
{
"actions":[
{
"action_executor":"externalAction",
"executor_property":{
// Custom, to be pushed through the message queue
}
}
]
}
Example of delay actions
{
"action_executor":"delay",
"executor_property":{
"hours":"0",
"minutes": "0",
"seconds": "5"
}
}
Mapping between code data types and operators
type | operator |
---|---|
Boolean | “==” |
Integer | “>”,“==”,“<” |
Enum | “==” |
Parameter | Type | Description |
---|---|---|
code | Integer | The response code. For more information, see Global Error Codes. |
success | Boolean | Indicates whether the operation is successful. Valid values:
|
msg | String | The message that is returned if the request fails. It is empty if the request is successful. |
t | Long | The returned 13-digit timestamp. |
result | String | true is returned when the operation is successful. |
{
"success": true,
"t": 1541072348540,
"result": true
}
{
"success": false,
"code": 1100,
"msg": "param is empty",
"t": 1540954683193
}
Delete automation scene configurations of the specified home.
DELETE /v1.0/homes/{home_id}/automations/{automation_id}
Parameter | Type | Parameter type | Description | Required |
---|---|---|---|---|
home_id | Long | URI | The ID of the user’s home. | Yes |
automation_id | String | URI | The automation scene ID. | Yes |
DELETE /v1.0/homes/242****/automations/53IYSXI3gEn2w3Oc
Parameter | Type | Description |
---|---|---|
code | Integer | The response code. For more information, see Global Error Codes. |
success | Boolean | Indicates whether the operation is successful. Valid values:
|
msg | String | The message that is returned if the request fails. It is empty if the request is successful. |
t | Long | The returned 13-digit timestamp. |
result | String | Indicates whether the automation scene is deleted successfully. true is returned when the operation is successful. |
{
"success": true,
"t": 1541072348540,
"result":true
}
{
"success": false,
"code": 1100,
"msg": "param is empty",
"t": 1540954683193
}
Query a list of automation scenes.
GET /v1.1/homes/{home_id}/automations
Parameter | Type | Parameter type | Description | Required |
---|---|---|---|---|
home_id | Long | URI | The ID of the user’s home. | Yes |
GET /v1.1/homes/242****/automations
Parameter | Type | Description |
---|---|---|
code | Integer | The response code. For more information, see Global Error Codes. |
success | Boolean | Indicates whether the operation is successful. Valid values:
|
msg | String | The message that is returned if the request fails. It is empty if the request is successful. |
t | Long | The returned 13-digit timestamp. |
result | List | The returned result. |
Result
Parameter | Type | Description |
---|---|---|
automation_id | String | The ID of the specified automation scene. |
name | String | The name of the specified automation scene. |
enabled | Boolean | The enabling status. |
status | String | The status. Valid values: 1 : normal, 2 : expired. |
background | String | The background image. |
conditions | List | A list of scene conditions. |
preconditions | List | The precondition. |
actions | List | A list of actions. |
match_type | Integer | Indicates the matching types. Valid values:
|
condition_rule | String | The custom condition rule. This parameter is required when the value of match_type is 3 . The custom condition rules follow the AND OR formula. Each automation condition is identified by its order_num . |
Conditions
Parameter | Type | Description | Required |
---|---|---|---|
entity_type | Integer | The type of condition. The following condition types are supported:
|
Yes |
display | JSON | Shows the conditions. | Yes |
order_num | Integer | The serial number of the specified condition, starting from 1 . |
Yes |
entity_id | String | The ID of the specified entity that executes the action. Valid values:
|
No |
Display device status conditions
Parameter | Type | Description | Required |
---|---|---|---|
code | String | The statusCode of the specified device. |
Yes |
operator | String | The operator. For more information, see Mapping between code data types and operators. | Yes |
value | String | The value of the specified code. | Yes |
Display external conditions
Parameter | Type | Description | Required |
---|---|---|---|
code | String | The key of the specified external condition. | Yes |
operator | String | The operator. For more information, see Mapping between code data types and operators. | Yes |
value | Object | The code value for the key of the specified external condition. | Yes |
Display weather conditions
Parameter | Type | Description | Required |
---|---|---|---|
code | String | The key of the specified weather condition. For example, temp . |
Yes |
operator | String | The operator. For more information, see Mapping between code data types and operators. | Yes |
value | String | The code value for the key of the specified weather condition. | Yes |
Display scheduled task conditions
Parameter | Type | Description | Required |
---|---|---|---|
date | String | The date when a scheduled task is triggered, in the format of yyyyMMdd . For example, 20191125 . |
Yes |
loops | String | A seven-digit number consisting of 0 and 1 . 0 means disabled and 1 means enabled. The first digit represents Sunday and the other digits represent Monday to Saturday sequentially. For example, 0011000 represents a scheduled task is executed every Tuesday and Wednesday. |
Yes |
time | String | The trigger time in the format of 24-hour time. For example, 14:00 . |
Yes |
timezone_id | String | The time zone ID. Fo example, Asia/Shanghai . |
Yes |
Description of preconditions
The preconditions. You can set the specified time period as a precondition.
Parameter | Type | Description | Required |
---|---|---|---|
cond_type | String | Currently, you can only set the specified time period as a precondition. Valid value: timeCheck . |
Yes |
display | JSON | Shows the conditions. | Yes |
Description of display in preconditions
Parameter | Type | Description | Required |
---|---|---|---|
start | String | The start time in the format of 24-hour time. The default value is a time point of the day. For example, 10:00 . |
Yes |
end | String | The end time in the format of 24-hour time. For example, 22:00 . |
Yes |
loops | String | A seven-digit number consisting of 0 and 1 . 0 means disabled and 1 means enabled. The first digit represents Sunday and the other digits represent Monday to Saturday sequentially. For example, 0011000 represents a scheduled task is executed every Tuesday and Wednesday. |
Yes |
timezone_id | String | The time zone ID. Fo example, Asia/Shanghai . |
Yes |
Description of devices involved in actions
Parameter | Type | Description | Required |
---|---|---|---|
entity_id | String | The device ID. | Yes |
executor_property | JSON | The property of the specified execution action. | Yes |
action_executor | String | The type of action. Valid value: dpIssue . |
Yes |
Description of external actions
Parameter | Type | Description | Required |
---|---|---|---|
executor_property | JSON | A custom external action. | Yes |
action_executor | String | The type of action. Valid value: externalAction . |
Yes |
Mapping between code data types and operators
type | operator |
---|---|
Boolean | “==” |
Integer | “>”,“==”,“<” |
Enum | “==” |
{
"result":[
{
"actions":[
{
"action_executor":"delay",
"executor_property":{
"hours":"0",
"minutes": "0",
"seconds": "5"
}
},
{
"action_executor":"dpIssue",
"entity_id":"vdevo15725982542****",
"executor_property":{
"switch_1":true
}
},
{
"action_executor":"externalAction",
"executor_property":{
// Subject to your customization
}
}
],
"automation_id":"p2aWOkEOe2RzA****",
"background":"https://images.tuyacn.com/smart/rule/cover/bedroom.png",
"conditions":[
{
"display":{
"code":"switch_1",
"operator":"==",
"value":true
},
"entity_id":"vdevo15725982542****",
"entity_type":1,
"order_num":1
}
],
"enabled": true,
"status": "1",
"match_type":1,
"name":"Automation Test",
},
{
"automation_id":"L07BQVabdqwFP****",
"background":"https://images.tuyacn.com/smart/rule/cover/house6.png",
"conditions":[
{
"display":{
"code":"battery_percentage",
"operator":"<",
"value":255
},
"entity_id":"vdevo156958314001****",
"entity_type":1,
"order_num":1
},
{
"display":{
"code":"mode",
"operator":"==",
"value":1
},
"entity_id":"weqszcaokqlmlkmlcanqklwokl****",
"entity_type":15,
"order_num":2
}
],
"enabled": true,
"match_type":1,
"name":"Automation Test 1",
}
],
"success":true,
"t":1572936751228
}
{
"success": false,
"code": 1100,
"msg": "param is empty",
"t": 1540954683193
}
Query the specified automation scene of the specified home.
GET /v1.0/homes/{home_id}/automations/{automation_id}
Parameter | Type | Parameter type | Description | Required |
---|---|---|---|---|
home_id | Long | URI | The ID of the user’s home. | Yes |
automation_id | String | URI | The ID of the specified automation scene. | Yes |
GET /v1.0/homes/242****/automations/53IYSXI3gEn2w3Oc
Parameter | Type | Description |
---|---|---|
code | Integer | The response code. For more information, see Global Error Codes. |
success | Boolean | Indicates whether the operation is successful. Valid values:
|
msg | String | The message that is returned if the request fails. It is empty if the request is successful. |
t | Long | The returned 13-digit timestamp. |
result | Object | The returned result. |
Result
Parameter | Type | Description |
---|---|---|
automation_id | String | The ID of the specified automation scene. |
name | String | The name of the specified automation scene. |
enabled | Boolean | The enabling status. |
background | String | The background image. |
conditions | List | A list of scene conditions. |
preconditions | List | The precondition. |
actions | List | A list of actions. |
match_type | Integer | Indicates the matching types. Valid values:
|
condition_rule | String | The custom condition rule. This parameter is required when the value of match_type is 3 . The custom condition rules follow the AND OR formula. Each automation condition is identified by its order_num . |
Conditions
Parameter | Type | Description | Required |
---|---|---|---|
entity_type | Integer | The type of condition. The following condition types are supported:
|
Yes |
display | JSON | Shows the conditions. | Yes |
order_num | Integer | The serial number of the specified condition, starting from 1 . |
Yes |
entity_id | String | The ID of the specified entity that executes the action. Valid values:
|
No |
Display device status conditions
Parameter | Type | Description | Required |
---|---|---|---|
code | String | The statusCode of the specified device. |
Yes |
operator | String | The operator. For more information, see Mapping between code data types and operators. | Yes |
value | String | The value of the specified code. | Yes |
Display external conditions
Parameter | Type | Description | Required |
---|---|---|---|
code | String | The key of the specified external condition. | Yes |
operator | String | The operator. For more information, see Mapping between code data types and operators. | Yes |
value | Object | The code value for the key of the specified external condition. | Yes |
Display weather conditions
Parameter | Type | Description | Required |
---|---|---|---|
code | String | The key of the specified weather condition. For example, temp . |
Yes |
operator | String | The operator. For more information, see Mapping between code data types and operators. | Yes |
value | String | The code value for the key of the specified weather condition. | Yes |
Display scheduled task conditions
Parameter | Type | Description | Required |
---|---|---|---|
date | String | The date when a scheduled task is triggered, in the format of yyyyMMdd . For example, 20191125 . |
Yes |
loops | String | A seven-digit number consisting of 0 and 1 . 0 means disabled and 1 means enabled. The first digit represents Sunday and the other digits represent Monday to Saturday sequentially. For example, 0011000 represents a scheduled task is executed every Tuesday and Wednesday. |
Yes |
time | String | The trigger time in the format of 24-hour time. For example, 14:00 . |
Yes |
timezone_id | String | The time zone ID. Fo example, Asia/Shanghai . |
Yes |
Description of preconditions
The preconditions. You can set the specified time period as a precondition.
Parameter | Type | Description | Required |
---|---|---|---|
cond_type | String | Currently, you can only set the specified time period as a precondition. Valid value: timeCheck . |
Yes |
display | JSON | Shows the conditions. | Yes |
Description of display in preconditions
Parameter | Type | Description | Required |
---|---|---|---|
start | String | The start time in the format of 24-hour time. The default value is a time point of the day. For example, 10:00 . |
Yes |
end | String | The end time in the format of 24-hour time. For example, 22:00 . |
Yes |
loops | String | A seven-digit number consisting of 0 and 1 . 0 means disabled and 1 means enabled. The first digit represents Sunday and the other digits represent Monday to Saturday sequentially. For example, 0011000 represents a scheduled task is executed every Tuesday and Wednesday. |
Yes |
timezone_id | String | The time zone ID. Fo example, Asia/Shanghai . |
Yes |
Description of devices involved in actions
Parameter | Type | Description | Required |
---|---|---|---|
entity_id | String | The device ID. | Yes |
executor_property | JSON | The property of the specified execution action. | Yes |
action_executor | String | The type of action. Valid value: dpIssue . |
Yes |
Description of external actions
Parameter | Type | Description | Required |
---|---|---|---|
executor_property | JSON | A custom external action. | Yes |
action_executor | String | The type of action. Valid value: externalAction . |
Yes |
Mapping between code data types and operators
type | operator |
---|---|
Boolean | “==” |
Integer | “>”,“==”,“<” |
Enum | “==” |
{
"result":[{
"actions":[
{
"action_executor":"delay",
"executor_property":{
"hours":"0",
"minutes": "0",
"seconds": "5"
}
},
{
"action_executor":"dpIssue",
"entity_id":"vdevo15725982542****",
"executor_property":{
"switch_1":true
}
},
{
"action_executor":"externalAction",
"executor_property":{
// Subject to your customization
}
}
],
"automation_id":"p2aWOkEOe2RzA****",
"background":"https://images.tuyacn.com/smart/rule/cover/bedroom.png",
"conditions":[
{
"display":{
"code":"switch_1",
"operator":"==",
"value":true
},
"entity_id":"vdevo15725982542****",
"entity_type":1,
"order_num":1
}
],
"enabled": true,
"match_type":1,
"name":"Automation Test",
},
{
"automation_id":"L07BQVabdqwFP****",
"background":"https://images.tuyacn.com/smart/rule/cover/house6.png",
"conditions":[
{
"display":{
"code":"battery_percentage",
"operator":"<",
"value":255
},
"entity_id":"vdevo156958314001****",
"entity_type":1,
"order_num":1
},
{
"display":{
"code":"mode",
"operator":"==",
"value":1
},
"entity_id":"weqszcaokqlmlkmlcanqklwokl****",
"entity_type":15,
"order_num":2
}
],
"enabled": true,
"match_type":1,
"name":"Automation Test 1",
},
"success":true,
"t":1572936751228
}
{
"success": false,
"code": 1100,
"msg": "param is empty",
"t": 1540954683193
}
Query external conditions triggering an automation scene in the specified home.
POST /v1.0/homes/{home_id}/automations/{automation_id}/conditions/trigger
Parameter | Type | Parameter type | Description | Required |
---|---|---|---|---|
home_id | Long | URI | The ID of the user’s home. | Yes |
automation_id | String | URI | The ID of the specified automation scene. | Yes |
conditions | List | Body | The list of scene conditions. | Yes |
Conditions
Parameter | Type | Description | Required |
---|---|---|---|
entity_id | String | The ID of the specified external condition. | Yes |
display | JSON | The condition that triggers an automation scene. | Yes |
Display
Parameter | Type | Description | Required |
---|---|---|---|
code | String | The statusCode of the specified device. |
Yes |
value | String | The value of the specified code. | Yes |
POST /v1.0/homes/242****/automations/53IYSXI3gEn2w3Oc/conditions/trigger
[{
"entity_id":"c9a5a524-d973-4b59-9390-0dcda0f1****",
"display":{
"code":"test",
"value":"test"
}
}]
Parameter | Type | Description |
---|---|---|
code | Integer | The response code. For more information, see Global Error Codes. |
success | Boolean | Indicates whether the operation is successful. Valid values:
|
msg | String | The message that is returned if the request fails. It is empty if the request is successful. |
t | Long | The returned 13-digit timestamp. |
result | String | Indicates whether the scene is triggered successfully. true is returned when the operation is successful. |
{
"success": true,
"t": 1541072348540,
"result": true
}
{
"success": false,
"code": 1100,
"msg": "param is empty",
"t": 1540954683193
}
Query a list of devices that support the specified automation scene in the specified home.
GET /v1.0/homes/{home_id}/automation/devices
Parameter | Type | Parameter type | Description | Required |
---|---|---|---|---|
home_id | Long | URI | The ID of the user’s home. | Yes |
type | String | URL | The supported type. Valid values:
|
No |
If the type
parameter is not output, all devices that support automation scenes will be returned.
Parameter | Type | Description |
---|---|---|
code | Integer | The response code. For more information, see Global Error Codes. |
success | Boolean | Indicates whether the operation is successful. Valid values:
|
msg | String | The message that is returned if the request fails. It is empty if the request is successful. |
t | Long | The returned 13-digit timestamp. |
result | List | The returned result. |
Result
Parameter | Type | Description |
---|---|---|
device_id | String | The device ID. |
uuid | String | The universally unique identifier (UUID) of the specified device. |
name | String | The name. |
home_id | String | The home ID. |
product_id | String | The product ID. |
GET /v1.0/homes/242****/automation/devices?type=condition
{
"result":[
{
"id":"vedo123****",
"uuid":"asdfghnbvcx****",
"name":"Test Device",
"product_id":"r4567543****",
"home_id":"242****"
}
],
"success":true,
"t":1572936751228
}
{
"success": false,
"code": 1100,
"msg": "param is empty",
"t": 1540954683193
}
Query various weather conditions supported by the specified automation scene.
GET /v1.0/homes/automation/weather/conditions
Parameter | Type | Description |
---|---|---|
code | Integer | The response code. For more information, see Global Error Codes. |
success | Boolean | Indicates whether the operation is successful. Valid values:
|
msg | String | The message that is returned if the request fails. It is empty if the request is successful. |
t | Long | The returned 13-digit timestamp. |
result | List | The returned result. |
Result
Parameter | Type | Description |
---|---|---|
category | String | The category. |
category_name | String | The name of the specified category. |
operators | String | The operator. |
property | JSON | The property of the specified category. |
GET /v1.0/homes/automation/weather/conditions
{
"result":[
{
"category":"temp",
"category_name":"Temperature",
"operators":"[\"<\",\"==\",\">\"]",
"property":{
"unit": "℃",
"min": -40,
"max": 40,
"step": 1,
"type": "value"
},
}
],
"success":true,
"t":1572936751228
}
{
"success": false,
"code": 1100,
"msg": "param is empty",
"t": 1540954683193
}
Get the standard data points of linkage conditions or execution actions based on the home ID.
GET /v1.0/homes/{home_id}/enable-linkage/codes
Parameter | Type | Parameter type | Description | Required |
---|---|---|---|---|
home_id | String | URI | The home ID. | Yes |
GET /v1.0/homes/5232322/enable-linkage/codes
Parameter | Type | Description |
---|---|---|
code | Integer | The response code. For more information, see Global Error Codes. |
success | Boolean | Indicates whether the operation is successful. Valid values:
|
msg | String | The message that is returned if the request fails. It is empty if the request is successful. |
t | Long | The returned 13-digit timestamp. |
result | List | The returned result. |
Result
Parameter | Type | Description |
---|---|---|
device_id | String | The ID of the specified automation device. |
functions | List | The operation that is performed. |
status | List | The trigger condition of the specified operation. |
Functions
Parameter | Type | Description |
---|---|---|
code | String | The code of the standard data point sent from the cloud to a device. |
name | String | The code name. |
type | String | The type of data sent from the cloud to a device. The following data types are supported:
|
values | JSON | The value range of the specified code. |
Status
Parameter | Type | Description |
---|---|---|
code | String | The code of a standard status reported by a device to the cloud. |
name | String | The code name. |
type | String | The type of data reported to the cloud. The following data types are supported:
|
values | JSON | The value range of the specified code. |
{
"success": true,
"t": 1541072348540,
"result": [
{
"device_id": "0120090568c63a89****",
"functions": [
{
"name": "Brightness",
"code": "bright_value",
"type": "Integer",
"values": {
"max":255,
"min":25,
"scale":0,
"step":1,
"type":"value",
"unit":""
}
},
{
"name": "Switch",
"code": "switch_led",
"type": "Boolean"
}
],
"status": [
{
"name": "Mode",
"code": "work_mode",
"type": "Enum",
"values": {
"range": [
"white",
"colour",
"scene",
"scene_1",
"scene_2",
"scene_3",
"scene_4"
],
"type": "Enum"
}
}
]
}
]
}
{
"success": false,
"code": 1100,
"msg": "param is empty",
"t": 1540954683193
}
Get the standard data points of linkage conditions or execution actions based on the device ID.
GET /v1.0/devices/{device_id}/enable-linkage/codes
Parameter | Type | Parameter type | Description | Required |
---|---|---|---|---|
device_id | String | URI | The device ID. | Yes |
GET /v1.0/devices/0120090568c63a89cb34/enable-linkage/codes
Parameter | Type | Description |
---|---|---|
code | Integer | The response code. For more information, see Global Error Codes. |
success | Boolean | Indicates whether the operation is successful. Valid values:
|
msg | String | The message that is returned if the request fails. It is empty if the request is successful. |
t | Long | The returned 13-digit timestamp. |
result | Object | The returned result. |
Result
Parameter | Type | Description |
---|---|---|
device_id | String | The device ID. |
functions | List | The standard instruction for performing actions. |
status | List | The standard status that triggers an action. |
Functions
Parameter | Type | Description |
---|---|---|
code | String | The code of the standard data point sent from the cloud to a device. |
name | String | The code name. |
type | String | The type of data sent to a device. The following data types are supported:
|
values | JSON | The value range of the specified code. |
Status
Parameter | Type | Description |
---|---|---|
code | String | The code of a standard status reported by a device to the cloud. |
name | String | The code name. |
type | String | The type of data reported to the cloud. The following data types are supported:
|
values | JSON | The value range of the specified code. |
{
"success": true,
"t": 1541072348540,
"result": {
"device_id": "0120090568c63a89****",
"functions": [
{
"name": "Brightness",
"code": "bright_value",
"type": "Integer",
"values": {
"max":255,
"min":25,
"scale":0,
"step":1,
"type":"Integer",
"unit":""
}
},
{
"name": "Switch",
"code": "switch_led",
"type": "Boolean",
"values": {
"type": "Boolean"
}
}
],
"status": [
{
"name": "Mode",
"code": "work_mode",
"type": "Enum",
"values": {
"range": [
"white",
"colour",
"scene",
"scene_1",
"scene_2",
"scene_3",
"scene_4"
],
"type": "Enum"
}
}
]
}
}
{
"success": false,
"code": 1100,
"msg": "param is empty",
"t": 1540954683193
}
Enable the specified automation scene.
PUT /v1.0/homes/{home_id}/automations/{automation_id}/actions/enable
Parameter | Type | Parameter type | Description | Required |
---|---|---|---|---|
home_id | Long | The home ID. | URI | Yes |
automation_id | String | The ID of the specified automation scene. | URI | Yes |
Return parameters:
Parameter | Type | Description |
---|---|---|
code | Integer | The response code. For more information, see Global Error Codes. |
success | Boolean | Indicates whether the operation is successful. Valid values:
|
msg | String | The message that is returned if the request fails. It is empty if the request is successful. |
t | Long | The returned 13-digit timestamp. |
result | Boolean | The returned result. |
PUT /v1.0/homes/242****/automations/53IYSXI3gEn2w3Oc/actions/enable
{
"success": true,
"t": 1541072348540,
"result": true
}
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. |
Disable the specified automation scene.
PUT /v1.0/homes/{home_id}/automations/{automation_id}/actions/disable
Parameter | Type | Parameter type | Description | Required |
---|---|---|---|---|
home_id | Long | The home ID. | URI | Yes |
automation_id | String | The ID of the specified automation scene. | URI | Yes |
Return parameters:
Parameter | Type | Description |
---|---|---|
code | Integer | The response code. For more information, see Global Error Codes. |
success | Boolean | Indicates whether the operation is successful. Valid values:
|
msg | String | The message that is returned if the request fails. It is empty if the request is successful. |
t | Long | The returned 13-digit timestamp. |
result | Boolean | The returned result. |
PUT /v1.0/homes/242****/automations/53IYSXI3gEn2w3Oc/actions/disable
{
"success": true,
"t": 1541072348540,
"result": true
}
The following table lists common error codes for the API calls. For more error codes, see Global Error Codes.
Error code | Description |
---|---|
500 | A system error has occurred while processing your request. |
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback