Query the details of a specified automation scene based on the automation ID.
API address
GET: /v2.0/iot-03/automations/{automation_id}
Request parameter
| Parameter name |
Type |
IN |
Required |
Description |
| automation_id |
String |
uri |
true |
The automation ID. |
Return parameter
| Parameter name |
Type |
Description |
| result |
AutomationDetailRes |
The returned result. |
Description of result
| Parameter name |
Type |
Description |
| name |
String |
The name of a specified automation. |
| dsl |
AutomationDSLRes |
The language of automation rules. |
| preconditions |
LinkagePreconditionsRes |
The preconditions for a specified automation execution. |
| status |
Integer |
The enabling status of automation.Valid values: |
| automation_type |
String |
The type of automation. Valid values: local: local automation.lan: automation over LAN.cloud: automation in the cloud.
|
Description of preconditions
| Parameter name |
Type |
Description |
| trigger_type |
String |
The type of trigger. |
| precondition_trigger_rule |
PreconditionTriggerRuleRes |
The precondition trigger rule. See the details of precondition_trigger_rule. |
Description of dsl
| Parameter name |
Type |
Description |
| conditions_rule |
String |
The automation condition matching rules. |
| conditions |
List |
The list of automation conditions. |
| actions |
List |
The list of automation actions. |
Description of conditions
| Parameter name |
Type |
Description |
| trigger_type |
String |
The trigger type of a specified condition. |
| trigger_id |
String |
The condition trigger ID. |
| rule_num |
Integer |
The number of a specified trigger condition. |
| trigger_rule |
ConditionTriggerRuleRes |
The condition trigger rule. See the details of trigger_rule. |
Description of actions
| Parameter name |
Type |
Description |
| execution_type |
String |
The execution type. |
| execution_rule |
ActionExecutionRuleRes |
The execution rule. See the details of execution_rule. |
Request example
GET: /v2.0/iot-03/automations/7MShiTZq1tih****
Return example
{
"result": {
"automation_type": "cloud",
"preconditions": {
"trigger_type": "timeCheck",
"precondition_trigger_rule": {
"timer_format": "09:00-23:00 * * 0,1,2,3,4,5,6 *"
}
},
"name": "This is an automation scene",
"dsl": {
"conditions_rule": "or",
"conditions": [
{
"rule_num": 1,
"trigger_rule": {
"status_code": "switch_1",
"status_value": false,
"comparator": "=="
},
"trigger_id": "vdevo16275516176****",
"trigger_type": "deviceReport"
},
{
"rule_num": 2,
"trigger_rule": {
"timer_format": "17:50 18 10 * 2021"
},
"trigger_id": "timer",
"trigger_type": "timer"
},
{
"rule_num": 3,
"trigger_rule": {
"weather_value": 20,
"comparator": "<=",
"weather_code": "temp"
},
"trigger_id": "79340958999865****",
"trigger_type": "weather"
}
],
"actions": [
{
"execution_rule": {
"delay_seconds": 10
},
"execution_type": "delay"
},
{
"execution_rule": {
"execution_id": "vdevo16275516363****",
"function_value": 100,
"function_code": "bright_value"
},
"execution_type": "deviceIssue"
},
{
"execution_rule": {
"execution_id": "144790134147200****",
"function_value": true,
"function_code": "child_lock"
},
"execution_type": "deviceGroupIssue"
},
{
"execution_rule": {
"execution_id": "144790134147200****",
"function_value": true,
"function_code": "child_lock"
},
"execution_type": "deviceGroupIssue"
}
]
},
"status": 1
},
"t": 1635404735404,
"success": true
}
Error code
For more information, see error code.
Details of trigger_rule
- When
trigger_type is deviceReport:
| Parameter name |
Type |
Description |
Required |
| status_code |
String |
The device instruction. |
Yes |
| comparator |
String |
The comparator. |
Yes |
| status_value |
Object |
The device instruction value. |
Yes |
- When
trigger_type is timer:
| Parameter name |
Type |
Description |
Required |
| timer_format |
String |
The scheduled trigger time. Two formats are supported.- Specify the scheduled date in the format such as: [hour:min] [day of month] [month] [day of week] [year]. For example, 20:00 20 10 * 2021 (October 20, 2021, 8:00 pm).
- Specify the weekly cycle timer in the format such as: [hour:min] [day of month] [month] [day of week] [year]. For example, 20:00 * * 0,1,2,3 * (every Sunday, Monday, Tuesday, and Wednesday at 8:00 pm).
|
Yes |
- When
trigger_type is weather:
| Parameter name |
Type |
Description |
Required |
| weather_code |
String |
The weather code. |
Yes |
| comparator |
String |
The comparator. |
Yes |
| weather_value |
Object |
The value of the weather code. |
Yes |
Details of execution_rule
- When
execution_type is delay:
| Parameter name |
Type |
Description |
Required |
| delay_seconds |
Long |
The delay time. The value range is 1 to 5 × 60 × 60. Unit: second. |
Yes |
- When
execution_type is deviceIssue or deviceGroupIssue:
| Parameter name |
Type |
Description |
Required |
| execution_id |
String |
The ID of a specified device or device group. |
Yes |
| function_code |
String |
The instruction code of a device or device group. |
Yes |
| function_value |
Object |
The instruction value of a device or device group. |
Yes |
Details of precondition_trigger_rule
| Parameter name |
Type |
Description |
Required |
| timer_format |
String |
The timer format. The format is: [hour:min]-[hour:min] [day of month] [month] [day of week] [year]. For example, 9:30-18:00 * * 0,1,2,3,4,5,6 * (9:30 am to 6:00 pm every week) |
No |