Query Automation Scene

Last Updated on : 2024-01-11 05:54:42download

Query the specified automation scene of the specified home.

API address

GET: /v1.0/homes/{home_id}/automations/{automation_id}

Request parameter

Parameter nameTypeINRequiredDescription
home_idStringuritrueThe home ID.
automation_idStringuritrueThe automation ID.

Return parameter

Parameter nameTypeDescription
resultAutomationResThe returned result.

Description of result

Parameter nameTypeDescription
automation_idStringThe automation ID.
nameStringThe name of the specified automation scene.
backgroundStringThe background image.
preconditionsListThe precondition.
conditionsListThe linkage condition.
actionsListThe executed actions.
match_typeIntegerThe matching type. Valid values:
  • 1: Trigger a scene when any condition is met.
  • 2: Trigger a scene when all conditions are met.
  • 3: Trigger a scene when the custom conditions are met. Set the logic operation parameter condition_rule.
condition_ruleStringCustom 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.
enabledBooleanIndicates whether the feature is enabled. Valid values:
  • true: enabled.
  • false: disabled.

Description of preconditions

Parameter nameTypeDescription
idStringThe condition ID.
cond_typeStringCurrently, you can only set the specified time period as a precondition. Valid value: timeCheck.
displayMapShow the conditions.

Description of conditions

Parameter nameTypeDescription
entity_typeIntegerThe type of condition. The following types are supported. Valid values:
  • 1: device status condition
  • 15: external condition
  • 3: weather condition
  • 6: timer condition
entity_idStringThe entity that performs the specified action.
  • When the value of entity_type is 1, the value of entity_id is the device ID. Required.
  • When the value of entity_type is 15, the value of entity_id is automatically generated by the system.
  • When the value of entity_type is 3, the value of entity_id is the city ID.
  • When the value of entity_type is 6, the value of entity_id is timer.
displayMapShow the conditions.
order_numIntegerThe serial number of the specified condition, starting from 1.

Description of actions

Parameter nameTypeDescription
entity_idStringThe entity ID. It could be a device ID, weather, or temperature.
executor_propertyMapThe property that triggers an action.
action_executorStringThe type of action. Valid value: dpIssue.

Description of display

Parameter nameTypeDescription
displayStringShow the conditions.

Description of executor_property

Parameter nameTypeDescription
executor_propertyStringThe property that triggers an action.

Request example

GET: /v1.0/homes/242****/automations/53IYSXI3gEn2****

Return example

{
    "tid": "2dd4fae27d3b11ee82c7664ef4d3e193",
    "result": {
        "enabled": true,
        "automation_id": "rQdsf****VsDO6ON",
        "background": "",
        "preconditions": [
        ],
        "name": "Control the Light Based on Weather",
        "match_type": 1,
        "conditions": [
            {
                "expr_display": "Weather: Sunny",
                "display": {
                    "code": "condition",
                    "operator": "==",
                    "value": "sunny"
                },
                "entity_id": "100180****567473213",
                "entity_type": 3,
                "order_num": 1
            }
        ],
        "actions": [
            {
                "entity_id": "6856054****eb62e90e",
                "action_displayNew": {
                    "3": [
                        "Brightness",
                        "25"
                    ]
                },
                "executor_property": {
                    "bright_value": 25
                },
                "action_executor": "dpIssue"
            }
        ]
    },
    "t": 1699340362194,
    "success": true
}

Error code

For more information, see error code.