Last Updated on : 2023-12-07 03:33:57download
Add automation scenes to the specified home.
POST: /v1.0/homes/{home_id}/automations
Parameter name | Type | IN | Required | Description |
---|---|---|---|---|
home_id | String | uri | true | The home ID. |
Description of body
Parameter name | Type | IN | Required | Description |
---|---|---|---|---|
automation_id | String | body | false | The ID of the automation. |
name | String | body | true | The name of the automation. |
match_type | Integer | body | true | Matching type.
|
background | String | body | true | Background picture. |
conditions | List | body | true | The collection of conditions. |
actions | List | body | true | The collection of actions. |
Description of conditions
Parameter name | Type | IN | Required | Description |
---|---|---|---|---|
entity_id | String | body | true | ID of the entity. This could be device ID, weather, temperature. |
entity_type | Integer | body | true | Condition object type.
|
order_num | Integer | body | true | The sequence code cannot be repeated. |
display | Expr | body | true | The calculation expression. |
Description of actions
Parameter name | Type | IN | Required | Description |
---|---|---|---|---|
entity_id | String | body | true | The object ID of the specified action. |
action_executor | String | body | true | The object type of the specified action. Valid values:
|
executor_property | ExecutorProperty | body | true | The details of the specified action. |
Description of display
Parameter name | Type | IN | Required | Description |
---|---|---|---|---|
code | String | body | false | The code of the specified status. This parameter is required when entity_type is 1 or 3 .If 'entity_type' is' 3 ', the value needs to be defined as one of the following values: $temp, $humidity, $condition, $pm25, $aqi, $windSpeed, $sunsetrise. For more detailed weather content, please check the weather code API |
operator | String | body | false | The comparison expression. This parameter is required when entity_type is 1 or 3 . Valid values:
|
value | Object | body | false | The value of the specified status. This parameter is required when entity_type is 1 or 3 . |
date | String | body | false | The date when the specified linkage rule is triggered. |
time | String | body | false | The time when the specified linkage rule is triggered. |
loops | String | body | false | The cycle when the specified linkage rule is triggered. The value is 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. |
timezone_id | String | body | false | The ID of the specified time zone. |
Description of executor_property
Parameter name | Type | IN | Required | Description |
---|---|---|---|---|
$function_code | String | body | false | Instruction code. This parameter is required when 'action_executor' is' dpIssue 'or' deviceGroupDpIssue '. This parameter is a variable. The specific name should be the standard command code, such as switch_1, and the value value should be the standard command value, such as true. |
hours | Integer | body | false | Delay time, unit: hour. This parameter is required when 'action_executor' is' delay '. |
minutes | Integer | body | false | Delay time, unit: minute. This parameter is required when 'action_executor' is' delay '. |
seconds | Integer | body | false | Delay time, in seconds. This parameter is required when 'action_executor' is' delay '. |
Parameter name | Type | Description |
---|---|---|
result | String | The returned result automation ID. |
POST: /v1.0/homes/242****/automations
{
"conditions": [
{
"display": {
"code": "switch_1",
"operator": "==",
"value": true,
"time": "14:00",
"timezone_id": "Asia/Shanghai"
},
"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/bedr***.png",
"match_type": 1,
"name": "Automation Test"
}
{
"tid": "2c1fc5cf7f4511ee82774ab24801****",
"result": "ALAuMez3r2JM****",
"t": 1699564556521,
"success": true
}
For more information, see error code.
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback