创建场景联动
POST
/api/v1/scene_automations请求JSON
{
"name": "111122222",
"description": "xxx",
"enabled": "Y",
"trigger_condition_groups": [
[
{
"trigger_conditions_type": "10",
"trigger_source": "设备id",
"trigger_param_type": "TEL",
"trigger_param": "temperature",
"trigger_operator": ">",
"trigger_value": "20"
}
],
[
{
"trigger_conditions_type": "11",
"trigger_source": "设备配置id",
"trigger_param_type": "TEL",
"trigger_param": "temperature",
"trigger_operator": ">",
"trigger_value": "20"
},
{
"trigger_conditions_type": "22",
"trigger_value": "137|22:01:00+08:00|23:00:00+08:00"
}
],
[
{
"trigger_conditions_type": "20",
"execution_time": "2024-04-10T15:13:29+08:00",
"expiration_time": 5
}
],
[
{
"trigger_conditions_type": "21",
"task_type": "HOUR",
"params": "22:00+08:00",
"expiration_time": 5
}
],
[
{
"trigger_conditions_type": "21",
"task_type": "DAY",
"params": "11:22:00+08:00",
"expiration_time": 60
}
],
[
{
"trigger_conditions_type": "21",
"task_type": "WEEK",
"params": "123|11:22:00+07:00",
"expiration_time": 1440
}
],
[
{
"trigger_conditions_type": "21",
"task_type": "MONTH",
"params": "12T11:22:00+08:00",
"expiration_time": 60
}
]
],
"actions": [
{
"action_type": "10",
"action_target": "设备id",
"action_param_type": "telemetry",
"action_param": "temperature",
"action_value": "20"
},
{
"action_type": "11",
"action_target": "设备配置id",
"action_param_type": "telemetry",
"action_param": "temperature",
"action_value": "20"
},
{
"action_type": "20",
"action_target": "场景id"
},
{
"action_type": "30",
"action_target": "告警id"
}
]
}
expiration_time在时间条件重复中枚举为5-5min 10-10min 30-30min 60-1h 1440-1day 值是int,单位是分钟
trigger_conditions_type枚举说明
20- 单次定时
21- 重复定时
22- 时间范围
10- 设备ID
11- 设备配置ID
说明 | action_param_type | action_param | action_value |
---|---|---|---|
遥测 | telemetry | {"xxx":2} | |
属性 | attribute | {"xxx":"50"} | |
命令 | command | {"method":"ReSet","params":{"switch":1,"light":"close"}} | |
自定义遥测 | c_telemetry | {"xxx":2} | |
自定义属性 | c_attribute | {"xxx":2} | |
自定义命令 | c_command | {"method":"switch1","params":{"false":0}} |
请求参数
Body 参数application/json
name
string
必需
description
string
必需
enabled
string
必需
trigger_condition_groups
array [array]
必需
object
可选
actions
array [object {5}]
必需
action_type
string
必需
action_target
string
必需
action_param_type
string
必需
action_param
string
必需
action_value
string
必需
示例
{
"name": "111122222",
"description": "xxx",
"enabled": "Y",
"trigger_condition_groups": [
[
{
"trigger_conditions_type": "10",
"trigger_source": "设备id",
"trigger_param_type": "TEL",
"trigger_param": "temperature",
"trigger_operator": ">",
"trigger_value": "20"
}
],
[
{
"trigger_conditions_type": "11",
"trigger_source": "设备配置id",
"trigger_param_type": "TEL",
"trigger_param": "temperature",
"trigger_operator": ">",
"trigger_value": "20"
},
{
"trigger_conditions_type": "22",
"trigger_value": "137|22:01:00+08:00|23:00:00+08:00"
}
],
[
{
"trigger_conditions_type": "20",
"execution_time": "2024-04-10T15:13:29+08:00",
"expiration_time": 5
}
],
[
{
"trigger_conditions_type": "21",
"task_type": "HOUR",
"params": "22:00+08:00",
"expiration_time": 5
}
],
[
{
"trigger_conditions_type": "21",
"task_type": "DAY",
"params": "11:22:00+08:00",
"expiration_time": 60
}
],
[
{
"trigger_conditions_type": "21",
"task_type": "WEEK",
"params": "123|11:22:00+07:00",
"expiration_time": 1440
}
],
[
{
"trigger_conditions_type": "21",
"task_type": "MONTH",
"params": "12T11:22:00+08:00",
"expiration_time": 60
}
]
],
"actions": [
{
"action_type": "10",
"action_target": "设备id",
"action_param_type": "TEL",
"action_param": "temperature",
"action_value": "20"
},
{
"action_type": "11",
"action_target": "设备配置id",
"action_param_type": "TEL",
"action_param": "temperature",
"action_value": "20"
},
{
"action_type": "20",
"action_target": "场景id"
},
{
"action_type": "30",
"action_target": "告警id"
}
]
}
示例代码
返回响应
成功(200)
HTTP 状态码: 200
内容格式: JSONapplication/json
数据结构
code
integer
必需
message
string
必需
data
object
必需
scene_automation_id
string
必需
示例
{
"code": 200,
"message": "create scene automations successfully",
"data": {
"scene_automation_id": "633f42ab-9f77-0d0a-7839-97d020791a44"
}
}
最后修改时间: 7 个月前