Get Linkage Rule Details

Last Updated on : 2024-06-29 02:00:03download

Based on the linkage rule ID, get the details of the specified linkage rule.

API address

GET: /v2.0/cloud/scene/rule/{rule_id}

Request parameter

Parameter nameTypeINRequiredDescription
rule_idStringuritrueThe ID of the specified linkage rule.

Return parameter

Parameter nameTypeDescription
resultLinkageResponseThe returned result.

Description of result

Parameter nameTypeDescription
idStringThe ID of the specified linkage rule.
statusStringThe status. Valid values:
  • enable: Enable the specified linkage rule.
  • disable: Disable the specified linkage rule.
running_modeStringThe operation mode. Valid values:
  • local: local linkage.
  • lan: linkage over LAN.
  • cloud: linkage in the cloud.
space_idStringThe ID of the specified space that is associated with the linkage rule.
nameStringThe name of the specified linkage rule.
typeStringThe type of linkage. Valid values:
  • scene: tap-to-run.
  • automation: automation.
decision_exprStringThe condition expression. Valid values:
  • and: AND.
  • or: OR.
  • c1&c2: custom expression.
conditionsListThe collection of conditions.
actionsListThe collection of actions.
effective_timeEffectiveTimeThe effective time.

Description of effective_time

Parameter nameTypeDescription
startStringThe start time.
endStringThe end time.
loopsStringThe 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.
time_zone_idStringThe ID of the specified time zone.

Description of conditions

Parameter nameTypeDescription
entity_idStringThe object ID of the specified condition.
entity_typeStringThe object type of the specified condition. Valid values:
  • timer: timer.
  • weather: weather condition.
  • device_report: data reporting by the device.
codeIntegerThe unique code of the specified condition.
exprExprThe calculation expression.

Description of actions

Parameter nameTypeDescription
entity_idStringThe object ID of the specified action.
action_executorStringThe object type of the specified action. Valid values:
  • delay: Delay an action.
  • device_issue: Send an instruction to a device.
  • device_group_issue: Send an instruction to a device group.
executor_propertyExecutorPropertyThe details of the specified action.

Description of expr

Parameter nameTypeDescription
status_codeStringThe code of the specified status. This parameter is required when entity_type is device_report.
comparatorStringThe comparison expression. This parameter is required when entity_type is device_report and weather. Valid values:
  • ==: equal to.
  • >: greater than.
  • <: less than.
status_valueObjectThe value of the specified status. This parameter is required when entity_type is device_report.
dateStringThe date when the specified linkage rule is triggered.
timeStringThe time when the specified linkage rule is triggered.
loopsStringThe 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.
time_zone_idStringThe ID of the specified time zone.
weather_codeStringThe code of the specified status. This parameter is required when entity_type is weather.
weather_valueObjectThe value of the specified status. This parameter is required when entity_type is weather.

Description of executor_property

Parameter nameTypeDescription
function_codeStringThe code of the specified instruction. This parameter is required when action_executor is device_issue or device_group_issue.
function_valueObjectThe value of the specified instruction. This parameter is required when action_executor is device_issue or device_group_issue.
delay_secondsIntegerThe delay time. This parameter is required when action_executor is delay.

Request example

GET: /v2.0/cloud/scene/rule/***

Return example

{
    "tid": "c4b2df2ebbcc11eda71e169efc83a172",
    "result": {
        "effective_time": {
            "start": "00:00",
            "loops": "1111111",
            "end": "23:00",
            "time_zone_id": "Asia/Shanghai"
        },
        "type": "automation",
        "running_mode": "cloud",
        "name": "Linkage Test",
        "decision_expr": "or",
        "id": "***",
        "conditions": [
            {
                "code": 1,
                "entity_id": "***",
                "entity_type": "device_report",
                "expr": {
                    "status_code": "switcn_1",
                    "status_value": "true",
                    "comparator": "=="
                }
            }
        ],
        "actions": [
            {
                "entity_id": "***",
                "executor_property": {
                    "function_value": true,
                    "function_code": "switch_1"
                },
                "action_executor": "device_issue"
            }
        ],
        "space_id": "150***",
        "status": "disable"
    },
    "t": 1678072367076,
    "success": true
}

Error code

For more information, see error code.

Limits on API Request Frequency

For more information, see Limits on API Request Frequency.