Last Updated on : 2023-06-21 07:12:57download
Add a scene linkage. Specific conditions can trigger devices and device groups to implement linkage under the specified scene.
POST: /v1.0/iot-03/automations
Description of body
| Parameter name | Type | IN | Required | Description | 
|---|---|---|---|---|
| name | String | true | The name of a specified scene linkage. | |
| conditions | List | true | The trigger condition. | |
| actions | List | true | The executed actions. | |
| match_type | Integer | true | Indicates the matching types. 
 | |
| condition_rule | String | false | Custom condition rules. This parameter is required when match_typeis3. The custom condition rules follow the AND OR formula. Each automation condition is identified by itsorder_num. For example, in the expression ofc1 && c2, we can see thatc1andc2respectively represent the calculation results of the expressions whereorder_numis1and2. | |
| preconditions | List | false | The preconditions with the highest priority. | 
Description of preconditions
| Parameter name | Type | IN | Required | Description | 
|---|---|---|---|---|
| cond_type | String | true | The type of preconditions. According to effective time, set timeCheckto a fixed value. | |
| display | JSONObject | true | Shows the conditions. See details of the request parameters. | 
Description of conditions
| Parameter name | Type | IN | Required | Description | 
|---|---|---|---|---|
| entity_type | Integer | true | The type of a specified condition. Valid values: 
 | |
| display | JSONObject | true | Shows the conditions. | |
| order_num | Integer | true | The serial number of a specified condition, starting from 1. | |
| entity_id | String | true | The ID of a specified entity that executes the action. 
 | 
Description of actions
| Parameter name | Type | IN | Required | Description | 
|---|---|---|---|---|
| entity_id | String | true | Indicates the target ID. 
 | |
| executor_property | List | true | The parameter of the executed action. When action_executoriswarnReport, the value can be empty. | |
| action_executor | String | true | The type of the execution action: 
 | 
Description of executor_property
| Parameter name | Type | IN | Required | Description | 
|---|---|---|---|---|
| code | String | true | The code of the data point (DP). | |
| value | Object | true | The value of the DP. | 
| Parameter name | Type | Description | 
|---|---|---|
| result | String | The ID of a scene linkage. | 
POST: /v1.0/iot-03/automations
{
  "name": "xxx",
  "match_type": 3,
  "condition_rule": "c1||c2||c3",
  "preconditions": [
    {
      "cond_type": "timeCheck",
      "display": {
        "start": "01:00",
        "end": "23:00",
        "time_interval": "custom",
        "loops": "1111111",
        "time_zone_id": "Asia/Shanghai"
      }
    }
  ],
  "conditions": [
    {
      "entity_id": "vdevo33333333333333",
      "entity_type": 1,
      "order_num": 1,
      "display": {
        "code": "switch_led",
        "operator": "==",
        "value": true
      }
    },
    {
      "entity_id": "1001803662567473213",
      "entity_type": 3,
      "order_num": 2,
      "display": {
        "code": "sunsetrise",
        "operator": "==",
        "value": "sunset"
      }
    },
    {
      "entity_id": "timer",
      "entity_type": 6,
      "order_num": 3,
      "display": {
        "date": "20210616",
        "loops": "1111111",
        "time": "16:16",
        "time_zone_id": "Asia/Shanghai"
      }
    }
  ],
  "actions": [
    {
      "entity_id": "140433911111111111",
      "action_executor": "deviceGroupDpIssue",
      "executor_property": [
        {
          "code": "switch_led",
          "value": true
        }
      ]
    },
    {
      "entity_id": "vdevo33333333333333",
      "action_executor": "dpIssue",
      "executor_property": [
        {
          "code": "bright_value",
          "value": 50
        }
      ]
    }
  ]
}
{
    "result": "xxxxxx",
    "t": 1111111111111,
    "success": true
}
For more information, see error code.
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback