Linkage Configuration Rules

Introduction

  • Automation: The user can customize the setting of the conditions (Conditions) and actions (Actions), when the trigger condition is met, the set action is automatically executed.
  • Scene: The user can customize the actions (Actions) that need to be executed in the scene, and when the scene is triggered manually, the set actions are executed.
  • Multiple-conditions: The user can customize the trigger conditions (Conditions) to support multiple combinations of "AND" and "OR" conditions to trigger.

Linkage Creation Method

Created by system-defined actionDefinition or triggerDefinition

Through Linkage Configuration Interface, it can be created by querying system preset conditions and action configurations through the object model.

Create by customizing device attributes

Users can customize the linkage rules required for configuration through the attributes of the object model.

  • Conditions

Request Parameter(condition) (For the complete Request Parameter, please refer to the Create a linkage interface.)

Name Type Is required? Description
triggerDefinitionId String Yes Fixed parameters: TD.custom_1
subjectId String Yes Subject ID (Such as device id, scene id) (must be filled in with model or subjectid)
model String Yes Object model
triggerDefinitionId String Yes Trigger Id. Fixed parameters: TD.custom_1
beginTime String No Begin time.
endTime String No End time.
params Array(Object) Yes Parameters, see params description for details

Request Parameter(params)

Name Type Is required? Description
paramId String Yes Parameter id. Fixed value: PD.custom.trigger
value String Yes The specific attribute to be judged, JSONArrayString, see value description for details.

Request Parameter(value)

Name Type Is required? Description
rid String Yes Specific resource id
value String Yes Value
op String Yes Operator comparison operator
Less than: 0
Greater than: 1
Less than or equal to: 2
Greater than or equal to: 3
Equal to: 4
Last time not equal to now equal to: 5
Last time less than or equal to now greater than: 6
Last time greater than or equal to now less than: 7
eventType int Yes Event type
0-can only be used to trigger execution
1-can only be used for conditional judgment and cannot trigger execution
2-can be used for both trigger execution and conditional judgment

Example: Illumination is higher than 3000lux , turn on the plug.

{
    "intent": "config.linkage.create",
    "data": {
    "name": "123456",
    "positionId": "xxxx",
    "conditions": {
        "condition": [
        {
            "triggerDefinitionId": "TD.custom_1",
            "subjectId": "lumi.158d000xxxxxx",
            "model": "lumi.sen_ill.agl01",
            "params": [
                {
                    "value": "{\"rid\":\"0.2.85\",\"op\":1,\"value\":\"3000\",\"eventType\":1}",
                    "paramId": "PD.custom.trigger"
                }
            ]
        }
    ],
    "relation": "1"
    },
    "actions": {
        "action": [
        {
            "actionDefinitionId": "AD.lumi.plug.open",
            "subjectId": "lumi.158d00xxxxxx",
            "model": "lumi.plug.maeu01",
            "params": []
        }
    ]
}}
}
  • Actions

Request Parameter(action)(For the complete Request Parameter, please refer to the Create a linkage interface.)

Name Type Is required? Description
subjectId String Yes Subject ID (Such as device id, scene id) (must be filled in with model or subjectid)
model String No Object model
actionDefinitionId String Yes Action Id. Fixed parameters: AD.custom_1
delayTime String No Delay Time, 0-59 second, 0-59 minute
delayTimeUnit String No Delay Time Unit, 1-second, 2-minute
params Array(Object) No Parameters, see params description for details

Request Parameter(params)

Name Type Is required? Description
paramId String Yes Parameter id. Fixed value: PD.custom.exec
value String Yes The specific attribute to be judged, JSONArrayString, see value description for details.

Request Parameter(value)

Name Type Is required? Description
rid String Yes Specific resource id
value String Yes Value

Example: Illuminance is higher than 3000lux. The gateway plays music, set the volume to 40%, and set the background music to 10.

{
    "intent":"config.linkage.create",
    "data":{
        "name":"123456",
        "positionId":"xxxx",
        "conditions":{
            "condition":[
                {
                    "triggerDefinitionId":"TD.lumi.sen_ill.agl01.illumination_higher",
                    "subjectId":"lumi.158d000xxxxxx",
                    "model":"lumi.sen_ill.agl01",
                    "params":[
                        {
                            "value":"3000",
                            "paramId":"PD.illumination"
                        }
                    ]
                }
            ],
            "relation":"1"
        },
        "actions":{
            "action":[
                {
                    "actionDefinitionId":"AD.custom_1",
                    "subjectId":"lumi.158d00xxxxxx",
                    "model":"lumi.gateway.iragl01",
                    "params":[
                        {
                            "paramId":"PD.custom.exec",
                            "value": "[{\"rid\":\"14.3.85\",\"value\":\"10\"},{\"rid\":\"14.3.1000\",\"value\":\"40\"}]"
                        }
                    ]
                }
            ]
        }
    }
}

Localization Rules

When the linkage or scene meets the localization conditions, it will be sent to the gateway for local execution, that is, when there is no network, the execution can be triggered normally.

The current rules that do not meet localization are:

  • When multiple gateways are in different LANs;
  • When the device that triggers the condition comes from multiple gateways, for example, the motion sensor under gateway A detects someone and the socket under gateway B is opening;
  • When the execution action is a cloud scene;
  • When the execution action is cloud automation on or off.

Demo

Demo 1: Illumination is higher than 3000lux , turn on the plug.

{
    "intent": "config.linkage.create",
    "data": {
    "name": "123456",
    "positionId": "xxxx",
    "conditions": {
        "condition": [
        {
            "triggerDefinitionId": "TD.lumi.sen_ill.agl01.illumination_higher",
                  "subjectId": "lumi.158d000xxxxxx",
            "model": "lumi.sen_ill.agl01",
            "params": [
                {
                    "value": "3000",
                    "paramId": "PD.illumination"
                }
            ]
        }
    ],
    "relation": "1"
    },
    "actions": {
        "action": [
        {
            "actionDefinitionId": "AD.lumi.plug.open",
            "subjectId": "lumi.158d00xxxxxx",
            "model": "lumi.plug.maeu01",
            "params": []
        }
    ]
}}
}

Demo 2: Regularly play music at 12 o'clock every day.

{
    "intent": "config.linkage.create",
    "data": {
    "name": "123456",
    "positionId": "xxxx",
    "conditions": {
        "condition": [
        {
            "triggerDefinitionId": "TD.app.timer.timer",
            "subjectId": "",
            "model": "app.timer.v1",
            "params": [
                {
                    "value": "00 10 * * 1,2,3,4,5,6,0",
                    "paramId": "PD.timer"
                }
            ]
        }
    ],
    "relation": 1
    },
    "actions": {
        "action": [
        {
            "actionDefinitionId": "AD.lumi.gateway.music",
            "subjectId": "lumi.158d0xxxxxxxx",
            "model": "lumi.gateway.iragl01",
            "params": [
                {
                    "value": "10",
                    "paramId": "PD.musicIndex"
                },
                {
                    "value": 40,
                    "paramId": "PD.vol"
                }
            ]
        }
    ]
}}}

Demo 3: Triggering scene execution when someone passes.

{
    "intent": "config.linkage.create",
    "data": {
    "name": "123456",
    "positionId": "xxxx",
    "conditions": {
        "condition": [
        {
            "triggerDefinitionId": "TD.lumi.sensor_motion.motion",
            "subjectId": "lumi.158d000xxxxxx",
            "params": []
        }
    ],
    "relation": "0"
    },
    "actions": {
        "action": [
        {
            "actionDefinitionId": "AD.app.scene.exc",
            "subjectId": "AL.xxxxxxxx",
            "params": []
        }
    ]
}}}

Demo 4: When the door is opening and someone passes, turn off the plug.

{
    "intent": "config.linkage.create",
    "data": {
    "name": "123456",
    "positionId": "xxxx",
    "conditions": {
        "condition": [
        {
            "triggerDefinitionId": "TD.lumi.sensor_motion.motion",
            "subjectId": "lumi.158d000xxxxxx",
            "model": "lumi.motion.agl02",
            "params": []
        },
        {
            "triggerDefinitionId": "TD.lumi.sensor_magnet.opening",
            "subjectId": "lumi.158d000xxxxxx",
            "model": "lumi.magnet.agl02",
            "params": []
        }
    ],
    "relation": "0"
    },
    "actions": {
        "action": [
        {
            "actionDefinitionId": "AD.lumi.plug.close",
            "subjectId": "lumi.158d00xxxxxx",
            "model": "lumi.plug.maeu01",
            "params": []
        }
    ]
}}}

Demo 5: When the door is open or someone passes, turn off the plug.

{
    "intent": "config.linkage.create",
    "data": {
    "name": "123456",
    "positionId": "xxxx",
    "conditions": {
        "condition": [
        {
            "triggerDefinitionId": "TD.lumi.sensor_motion.motion",
            "subjectId": "lumi.4cf8cdf3c738348",
            "model": "lumi.motion.agl02",
            "params": []
        },
        {
            "triggerDefinitionId": "TD.lumi.sensor_magnet.open",
            "subjectId": "lumi.4cf8cdf3c738170",
            "model": "lumi.magnet.agl02",
            "params": []
        }
    ],
    "relation": 1
    },
    "actions": {
        "action": [
        {
            "actionDefinitionId": "AD.lumi.plug.open",
            "subjectId": "lumi.4cf8cdf3c7464cc",
            "model": "lumi.plug.maeu01",
            "params": []
        }
    ]
}}}
Copyright © 2023 Lumi United Technology Co., Ltd. all right reserved,powered by GitbookFile Modify: 2024-04-24 15:18:24

results matching ""

    No results matching ""