更新时间:2023-06-15 05:07:33
本文介绍获取场景模板详情的 API。
通过场景模板ID获取场景模板详情。
GET: /v1.0/iot-03/scene-templates/{template_id}
| 参数名 | 类型 | 参数位置 | 是否必填 | 说明 | 
|---|---|---|---|---|
| template_id | Long | uri | true | 场景模板id | 
| 参数名 | 类型 | 说明 | 
|---|---|---|
| result | SceneTemplateRes | 
result 说明
| 参数名 | 类型 | 说明 | 
|---|---|---|
| name | String | 场景模板名称 | 
| desc | String | 场景模板描述 | 
| dsl | Object | 场景模板规则语言 | 
| preconditions | Object | 场景模板前置条件 | 
preconditions 说明
| 参数名 | 类型 | 说明 | 
|---|---|---|
| trigger_type | String | 触发类型。目前只有 timeCheck。 | 
| trigger_rule | Object | 前置条件触发规则。见前置条件的trigger_rule 详细说明。 | 
dsl 说明
| 参数名 | 类型 | 说明 | 
|---|---|---|
| conditions | List | 场景模板条件列表 | 
| conditions_rule | String | 场景模板条件匹配规则:
  | 
| actions | List | 场景模板动作列表 | 
conditions 说明
| 参数名 | 类型 | 说明 | 
|---|---|---|
| trigger_type | String | 触发类型:
  | 
| trigger_id | String | 条件触发 ID: 条件触发类型 trigger_type为categoryReport时,trigger_id为品类码;条件触发类型 trigger_type为timer时,trigger_id固定为timer;条件触发类型 trigger_type为weather时,trigger_id固定城市 ID。 | 
| trigger_rule | Object | 条件触发规则。见conditions的trigger_rule详细说明 | 
| rule_num | Integer | 触发条件编号,用于条件匹配规则自定义条件计算。取值范围为1~条件的个数,且不能重复。 | 
actions 说明
| 参数名 | 类型 | 说明 | 
|---|---|---|
| execution_type | String | 执行类型:
  | 
| execution_rule | Object | 执行规则。见 execution_rule 详细说明。 | 
GET: /v1.0/iot-03/scene-templates/18*****8
{
    "result": {
        "preconditions": {
            "trigger_rule": {
                "timer_format": "00:00-23:59 * * 0,1,2,3,4,5,6 *"
            },
            "trigger_type": "timeCheck"
        },
        "name": "bulu-联动模板第一发",
        "dsl": {
            "conditions_rule": "or",
            "conditions": [
                {
                    "rule_num": 1,
                    "trigger_rule": {
                        "status_code": "switch_led",
                        "status_value": true,
                        "comparator": "=="
                    },
                    "trigger_id": "dj",
                    "trigger_type": "categoryReport"
                }
            ],
            "actions": [
                {
                    "execution_rule": {
                        "execution_id": "fskg",
                        "function_value": true,
                        "function_code": "switch_fan"
                    },
                    "execution_type": "categoryIssue"
                }
            ]
        },
        "desc": "第二个模板"
    },
    "t": 1636613445945,
    "success": true
}
参考 错误码。
1、当 trigger_type 为categoryReport时:
| 参数名 | 类型 | 说明 | 必填 | 
|---|---|---|---|
| status_code | String | 设备指令 | 是 | 
| comparator | String | 比较符 | 是 | 
| status_value | Object | 设备指令值 | 是 | 
2、当 trigger_type 为timer时:
| 参数名 | 类型 | 说明 | 必填 | 
|---|---|---|---|
| timer_format | String | 定时触发时间。支持两种格式:
  | 
是 | 
3、当trigger_type为weather时:
| 参数名 | 类型 | 说明 | 必填 | 
|---|---|---|---|
| weather_code | String | 天气码 | 是 | 
| comparator | String | 比较符 | 是 | 
| weather_value | Object | 天气码值 | 是 | 
1、当execution_type为delay时:
| 参数名 | 类型 | 说明 | 必填 | 
|---|---|---|---|
| delay_seconds | Long | 延时时间,取值范围 1~5 * 60 * 60,单位:秒 | 是 | 
2、当execution_type为categoryIssue时:
| 参数名 | 类型 | 说明 | 必填 | 
|---|---|---|---|
| execution_id | String | 品类码 | 是 | 
| function_code | String | 品类支持的指令码 | 是 | 
| function_value | Object | 品类支持的指令值 | 是 | 
| 参数名 | 类型 | 描述 | 必填 | 
|---|---|---|---|
| timer_format | String | 定时格式。格式为: [hour:min]-[hour:min] [day of month] [month] [day of week] [year],例如: 9:30-18:00 * * 0,1,2,3,4,5,6 * (每周上午9点半到下午6点) | 是 | 
该内容对您有帮助吗?
是意见反馈该内容对您有帮助吗?
是意见反馈