Query Automation Details

Last Updated on : 2023-07-06 08:26:43download

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 nameTypeINRequiredDescription
automation_idStringuritrueThe automation ID.

Return parameter

Parameter nameTypeDescription
resultAutomationDetailResThe returned result.

Description of result

Parameter nameTypeDescription
nameStringThe name of a specified automation.
dslAutomationDSLResThe language of automation rules.
preconditionsLinkagePreconditionsResThe preconditions for a specified automation execution.
statusIntegerThe enabling status of automation.Valid values:
  • 0: disabled.
  • 1: enabled.
automation_typeStringThe type of automation. Valid values:
  • local: local automation.
  • lan: automation over LAN.
  • cloud: automation in the cloud.

Description of preconditions

Parameter nameTypeDescription
trigger_typeStringThe type of trigger.
precondition_trigger_rulePreconditionTriggerRuleResThe precondition trigger rule. See the details of precondition_trigger_rule.

Description of dsl

Parameter nameTypeDescription
conditions_ruleStringThe automation condition matching rules.
conditionsListThe list of automation conditions.
actionsListThe list of automation actions.

Description of conditions

Parameter nameTypeDescription
trigger_typeStringThe trigger type of a specified condition.
trigger_idStringThe condition trigger ID.
rule_numIntegerThe number of a specified trigger condition.
trigger_ruleConditionTriggerRuleResThe condition trigger rule. See the details of trigger_rule.

Description of actions

Parameter nameTypeDescription
execution_typeStringThe execution type.
execution_ruleActionExecutionRuleResThe 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

  1. When trigger_type is deviceReport:
Parameter nameTypeDescriptionRequired
status_codeStringThe device instruction.Yes
comparatorStringThe comparator.Yes
status_valueObjectThe device instruction value.Yes
  1. When trigger_type is timer:
Parameter nameTypeDescriptionRequired
timer_formatStringThe 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
  1. When trigger_type is weather:
Parameter nameTypeDescriptionRequired
weather_codeStringThe weather code.Yes
comparatorStringThe comparator.Yes
weather_valueObjectThe value of the weather code.Yes

Details of execution_rule

  1. When execution_type is delay:
Parameter nameTypeDescriptionRequired
delay_secondsLongThe delay time. The value range is 1 to 5 × 60 × 60. Unit: second.Yes
  1. When execution_type is deviceIssue or deviceGroupIssue:
Parameter nameTypeDescriptionRequired
execution_idStringThe ID of a specified device or device group.Yes
function_codeStringThe instruction code of a device or device group.Yes
function_valueObjectThe instruction value of a device or device group.Yes

Details of precondition_trigger_rule

Parameter nameTypeDescriptionRequired
timer_formatStringThe 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