更新时间:2025-05-30 01:56:03下载pdf
智能场景之自动化,由用户设定条件,当条件触发后自动执行设定的动作。涂鸦云支持用户根据实际生活场景,通过设置设备条件,当条件满足时,让一个或多个设备执行相应的任务。
请求方式 | API | 描述 |
---|---|---|
GET | /v1.0/osaas/rooms/{room_id}/automations | 查询房屋下的自动化列表 |
GET | /v1.0/osaas/rooms/{room_id}/automations/{automation_id} | 查询房屋下的自动化详情 |
GET | /v1.0/osaas/rooms/{room_id}/automation/devices | 获取房屋下支持自动化的设备列表 |
GET | /v1.0/osaas/linkage/rooms/{room_id}/devices/specifications | 获取房屋支持联动的设备规格列表 |
GET | /v1.0/osaas/linkage/devices/{device_id}/specifications | 获取设备支持联动的规格列表 |
POST | /v1.0/osaas/rooms/{room_id}/automation | 新增自动化 |
PUT | /v1.0/osaas/rooms/{room_id}/automations/{automation_id} | 修改自动化 |
DELETE | /v1.0/osaas/rooms/{room_id}/automations/{automation_id} | 删除自动化 |
PUT | /v1.0/osaas/rooms/{room_id}/automations/{automation_id}/enable | 启用自动化 |
PUT | /v1.0/osaas/rooms/{room_id}/automations/{automation_id}/disable | 停用自动化 |
调用该接口查询房屋下的自动化列表
GET /v1.0/osaas/rooms/{room_id}/automations
参数名 | 类型 | 参数类型 | 说明 | 是否必需 |
---|---|---|---|---|
room_id | String | URI | 房屋唯一标识 | 是 |
参数名 | 类型 | 说明 |
---|---|---|
code | Integer | 响应码(详情见错误码章节),成功时为空 |
success | Boolean | 是否成功:(true:成功,false:失败) |
msg | String | 请求失败的信息,成功时为空 |
t | Long | 返回时间戳,13位 |
result | Arrays | 自动化列表 |
result参数说明
参数名 | 类型 | 说明 |
---|---|---|
automation_id | String | 自动化唯一标识 |
automation_name | String | 自动化名称 |
enabled | Boolean | 启用状态 |
conditions | Arrays | 条件列表 |
preconditions | Arrays | 前置条件 |
actions | Arrays | 动作列表 |
condition_rule | String | 自定义条件规则,当匹配类型 match_type=3,该参数 必传。自定义条件规则遵从与或运算公式。每个自动 化条件以其 order_num 为标识码 eg:order_num 依次为 1,2,3,业务场景为条件 1 与 2 同时满足,或者条件 3 满足的情况下会触发自动化, 则表达式为:1&&2 |
match_type | Integer | 匹配类型 1:任意条件满足触发, 2:全部条件满足触 发, 3:自定义条件触发,需设定相关逻辑运算参数condition_rule |
conditions 参数说明
参数名 | 类型 | 说明 |
---|---|---|
entity_type | Integer | 条件类型,目前支持设备状态条件 entity_type=1 |
entity_id | String | 执行动作实体,当 entity_type=1 时,即设备 ID |
display | Object | 条件展示 |
order_num | Integer | 条件排序,从 1 开始 |
display 参数说明
参数名 | 类型 | 说明 |
---|---|---|
code | String | 设备的状态编码 |
operator | String | 操作符 |
value | Object | 状态值 |
preconditions 参数说明
前置限制条件,是仅当该规则内才执行,目前支持时间段限制
参数名 | 类型 | 说明 |
---|---|---|
cond_type | String | 暂支持时间段限制,固定为 timeCheck |
display | Object | 条件展示 |
前置条件 display 参数说明
参数名 | 类型 | 说明 |
---|---|---|
start | String | 开始时间,默认为当天的某个时间点, 24 小时制,比 如"10:00" |
end | String | 结束时间,24 小时制,比如"22:00" |
loops | String | 由 0 和 1 组成的 7 位数字,0 表示不执行,1 表示执 行,第 1 位为周日,依次表示周一至周六,“0011000” 为每周二,周三执行 |
timezone_id | String | 时区 id,比如 Asia/Shanghai |
actions参数说明
参数名 | 类型 | 说明 |
---|---|---|
entity_id | String | 执行动作实体 |
executor_property | Object | 执行动作参数 |
action_executor | String | 执⾏动作类别 |
action_executor 参数说明
action_executor 目前共支持5种动作,分别是 dpIssue、delay、ruleTrigger、ruleEnable、ruleDisable。其中delay不能作为最后一个动作,动作列表不能有两个以上delay动作。
action_executor | executor_property | entity_id | 说明 |
---|---|---|---|
dpIssue | {dpCode: dpValue} | 设备唯一标识 | 设备动作 |
delay | {“hours”: “1”,“minutes”: “15”,“seconds”: “0”} | delay | 延迟动作。0<=hours<=4, 0<=minutes<=59, 0<=seconds<=59 |
ruleTrigger | {} | 场景实例唯一标识 | 场景触发动作 |
ruleEnable | {} | 自动化实例唯一标识 | 自动化启用动作 |
ruleDisable | {} | 自动化实例唯一标识 | 自动化禁用动作 |
GET {url}/v1.0/osaas/rooms/1222333******/automations
{
"result": [
{
"actions": [
{
"action_executor": "dpIssue",
"entity_id": "vdevo15725982******",
"executor_property": {
"switch_1": true
}
},
],
"automation_id": "p2aWOkEOe******",
"conditions": [
{
"display": {
"code": "switch_1",
"operator": "==",
"value": true
},
"entity_id": "vdevo15725982******",
"entity_type": 1,
"order_num": 1
}
],
"enabled": true,
"match_type": 1,
"automation_name": "测试自动化"
}
],
"success": true,
"t": 1572936751228
}
{
"code": 500,
"msg": "system error,please contact the admin",
"success": false,
"t": 1561378856383
}
调用该接口查询房屋下的自动化详情
GET /v1.0/osaas/rooms/{room_id}/automations/{automation_id}
参数名 | 类型 | 参数类型 | 说明 | 是否必需 |
---|---|---|---|---|
room_id | String | URI | 房屋唯一标识 | 是 |
automation_id | String | URI | 自动化唯一标识 | 是 |
参数名 | 类型 | 说明 |
---|---|---|
code | Integer | 响应码(详情见错误码章节),成功时为空 |
success | Boolean | 是否成功:(true:成功,false:失败) |
msg | String | 请求失败的信息,成功时为空 |
t | Long | 返回时间戳,13位 |
result | Object | 自动化详情 |
result参数说明
参数名 | 类型 | 说明 |
---|---|---|
automation_id | String | 自动化唯一标识 |
automation_name | String | 自动化名称 |
enabled | Boolean | 启用状态 |
conditions | Array | 条件列表 |
preconditions | Array | 前置条件 |
actions | Array | 动作列表 |
condition_rule | String | 自定义条件规则,当匹配类型 match_type=3,该参数 必传。自定义条件规则遵从与或运算公式。每个自动 化条件以其 order_num 为标识码 eg:order_num 依次为 1,2,3,业务场景为条件 1 与 2 同时满足,或者条件 3 满足的情况下会触发自动化, 则表达式为:1&&2 |
match_type | Integer | 匹配类型 1:任意条件满足触发, 2:全部条件满足触 发, 3:自定义条件触发,需设定相关逻辑运算参数condition_rule |
conditions 参数说明
参数名 | 类型 | 说明 |
---|---|---|
entity_type | Integer | 条件类型,目前支持设备状态条件 entity_type=1 |
entity_id | String | 执行动作实体,当 entity_type=1 时,即设备 ID |
display | Object | 条件展示 |
order_num | Integer | 条件排序,从 1 开始 |
display 参数说明
参数名 | 类型 | 说明 |
---|---|---|
code | String | 设备的状态编码 |
operator | String | 操作符 |
value | Object | 状态值 |
preconditions 参数说明
前置限制条件,是仅当该规则内才执行,目前支持时间段限制
参数名 | 类型 | 说明 |
---|---|---|
cond_type | String | 暂支持时间段限制,固定为 timeCheck |
display | Object | 条件展示 |
前置条件 display 参数说明
参数名 | 类型 | 说明 |
---|---|---|
start | String | 开始时间,默认为当天的某个时间点, 24 小时制,比 如"10:00" |
end | String | 结束时间,24 小时制,比如"22:00" |
loops | String | 由 0 和 1 组成的 7 位数字,0 表示不执行,1 表示执 行,第 1 位为周日,依次表示周一至周六,“0011000” 为每周二,周三执行 |
timezone_id | String | 时区 id,比如 Asia/Shanghai |
actions参数说明
参数名 | 类型 | 说明 |
---|---|---|
entity_id | String | 执行动作实体,当前支持设备,即设备 ID |
executor_property | Object | 执行动作参数 |
action_executor | String | 执⾏动作类别,当前⽀支持:dpIssue |
action_executor 参数说明
action_executor 目前共支持5种动作,分别是 dpIssue、delay、ruleTrigger、ruleEnable、ruleDisable。其中delay不能作为最后一个动作,动作列表不能有两个以上delay动作。
action_executor | executor_property | entity_id | 说明 |
---|---|---|---|
dpIssue | {dpCode: dpValue} | 设备唯一标识 | 设备动作 |
delay | {“hours”: “1”,“minutes”: “15”,“seconds”: “0”} | delay | 延迟动作。0<=hours<=4, 0<=minutes<=59, 0<=seconds<=59 |
ruleTrigger | {} | 场景实例唯一标识 | 场景触发动作 |
ruleEnable | {} | 自动化实例唯一标识 | 自动化启用动作 |
ruleDisable | {} | 自动化实例唯一标识 | 自动化禁用动作 |
GET {url}/v1.0/osaas/rooms/122233******/automations/53IYSXI3******
{
"result": {
"actions": [
{
"action_executor": "dpIssue",
"entity_id": "vdevo15725982******",
"executor_property": {
"switch_1": true
}
},
],
"automation_id": "p2aWOkEOe******",
"conditions": [
{
"display": {
"code": "switch_1",
"operator": "==",
"value": true
},
"entity_id": "vdevo15725982******",
"entity_type": 1,
"order_num": 1
}
],
"enabled": true,
"match_type": 1,
"automation_name": "测试自动化"
},
"success": true,
"t": 1572936751228
}
{
"code": 500,
"msg": "system error,please contact the admin",
"success": false,
"t": 1561378856383
}
调用该接口获取房屋下支持自动化的设备列表
GET /v1.0/osaas/rooms/{room_id}/automation/devices
参数名 | 类型 | 参数类型 | 说明 | 是否必需 |
---|---|---|---|---|
room_id | String | URI | 房屋唯一标识 | 否 |
page_no | Integer | URL | 页码(page_no>0) | 否 |
page_size | Integer | URL | 页条数(0<page_size<100) | 否 |
type | String | URL | 支持的类型,condition:条件;action:动作 | 否 |
参数名 | 类型 | 说明 |
---|---|---|
code | Integer | 响应码(详情见错误码章节),成功时为空 |
success | Boolean | 是否成功:(true:成功,false:失败) |
msg | String | 请求失败的信息,成功时为空 |
t | Long | 返回时间戳,13位 |
result | Object | 设备分页结果 |
result参数说明
参数名 | 类型 | 说明 |
---|---|---|
total | Integer | 总条数 |
page_no | Integer | 页码 |
page_size | Integer | 页条数 |
devices | Arrays | 设备列表 |
devices参数说明
参数名 | 类型 | 说明 |
---|---|---|
device_id | String | 设备唯一标识 |
device_name | String | 设备名称 |
product_id | String | 产品唯一标识 |
GET {url}/v1.0/osaas/rooms/12223333******/automation/devices?page_no=1&page_size=20
{
"result": {
"total": 1,
"page_no": 1,
"page_size": 20,
"devices": [
{
"device_id": "vedo1234456******",
"device_name": "测试设备",
"product_id": "r4567******"
}
]
},
"success": true,
"t": 1572936751228
}
{
"code": 500,
"msg": "system error,please contact the admin",
"success": false,
"t": 1561378856383
}
调用该接口获取房屋支持联动的设备规格列表
GET /v1.0/osaas/linkage/rooms/{room_id}/devices/specifications
参数名 | 类型 | 参数类型 | 说明 | 是否必需 |
---|---|---|---|---|
room_id | String | URI | 房屋唯一标识 | 是 |
page_no | Integer | URL | 页码(page_no>0) | 否 |
page_size | Integer | URL | 页条数(0<page_size<100) | 否 |
参数名 | 类型 | 说明 |
---|---|---|
code | Integer | 响应码(详情见错误码章节),成功时为空 |
success | Boolean | 是否成功:(true:成功,false:失败) |
msg | String | 请求失败的信息,成功时为空 |
t | Long | 返回时间戳,13位 |
result | Object | 设备联动规格分页结果 |
result参数说明
参数名 | 类型 | 说明 |
---|---|---|
total | Integer | 总条数 |
page_no | Integer | 页码 |
page_size | Integer | 页条数 |
devices | Arrays | 设备规格列表 |
devices参数说明
参数名 | 类型 | 说明 |
---|---|---|
device_id | String | 设备唯一标识 |
functions | Array | 功能集列表,用于动作执行 |
status | Array | 状态集列表,用于条件触发 |
functions参数说明
参数名 | 类型 | 说明 |
---|---|---|
code | String | 功能码 |
type | String | 功能类型,目前支持三种类型(Boolean,Integer,Enum) |
values | Object | 参数范围 |
status参数说明
参数名 | 类型 | 说明 |
---|---|---|
code | String | 状态码 |
name | String | 状态名称 |
type | String | 状态类型,目前支持三种类型(Boolean,Integer,Enum) |
values | Object | 参数范围 |
GET {url}/v1.0/osaas/linkage/rooms/122******/devices/specifications?page_no=1&page_size=20
{
"result": {
"total": 1,
"page_no": 1,
"page_size": 20,
"devices": [
{
"device_id": "0120090568c63******",
"functions": [
{
"name": "亮度",
"code": "bright_value",
"type": "Integer",
"values": {
"max": 255,
"min": 25,
"scale": 0,
"step": 1,
"type": "value",
"unit": ""
}
},
{
"name": "开关",
"code": "switch_led",
"type": "Boolean"
}
],
"status": [
{
"name": "模式",
"code": "work_mode",
"type": "Enum",
"values": {
"range": [
"white",
"colour"
]
}
}
]
}
]
},
"success": true,
"t": 1572936751228
}
{
"code": 500,
"msg": "system error,please contact the admin",
"success": false,
"t": 1561378856383
}
调用该接口获取设备支持联动的规格列表
GET /v1.0/osaas/linkage/devices/{device_id}/specifications
参数名 | 类型 | 参数类型 | 说明 | 是否必需 |
---|---|---|---|---|
device_id | String | URI | 设备唯一标识 | 是 |
参数名 | 类型 | 说明 |
---|---|---|
code | Integer | 响应码(详情见错误码章节),成功时为空 |
success | Boolean | 是否成功:(true:成功,false:失败) |
msg | String | 请求失败的信息,成功时为空 |
t | Long | 返回时间戳,13位 |
result | Object | 规格列表 |
result参数说明
参数名 | 类型 | 说明 |
---|---|---|
device_id | String | 设备唯一标识 |
functions | Arrays | 功能集列表,用于动作执行 |
status | Arrays | 状态集列表,用于条件触发 |
functions参数说明
参数名 | 类型 | 说明 |
---|---|---|
code | String | 功能码 |
type | String | 功能类型,目前支持三种类型(Boolean,Integer,Enum) |
values | Object | 参数范围 |
status参数说明
参数名 | 类型 | 说明 |
---|---|---|
code | String | 状态码 |
name | String | 状态名称 |
type | String | 状态类型,目前支持三种类型(Boolean,Integer,Enum) |
values | Object | 参数范围 |
GET {url}/v1.0/osaas/linkage/devices/1222333******/specifications
{
"result": [
{
"device_id": "0120090568c6******",
"functions": [
{
"name": "亮度",
"code": "bright_value",
"type": "Integer",
"values": {
"max": 255,
"min": 25,
"scale": 0,
"step": 1,
"type": "value",
"unit": ""
}
},
{
"name": "开关",
"code": "switch_led",
"type": "Boolean"
}
],
"status": [
{
"name": "模式",
"code": "work_mode",
"type": "Enum",
"values": {
"range": [
"white",
"colour"
],
"type": "Enum"
}
}
]
}
],
"success": true,
"t": 1572936751228
}
{
"code": 500,
"msg": "system error,please contact the admin",
"success": false,
"t": 1561378856383
}
调用该接口新增自动化
POST /v1.0/osaas/rooms/{room_id}/automation
参数名 | 类型 | 参数类型 | 说明 | 是否必需 |
---|---|---|---|---|
room_id | String | URI | 房屋唯一标识 | 是 |
automation_name | String | BODY | 自动化名称 | 是 |
conditions | Arrays | BODY | 条件列表 | 是 |
preconditions | Arrays | BODY | 前置条件,优先级最高 | 否 |
actions | Arrays | BODY | 动作列表 | 是 |
match_type | Integer | BODY | 匹配类型,1:任意条件满足 触发,2:全部条件满足触 发,3:自定义条件触发,需 设 定 相 关 逻 辑 运 算 参 数 condition_rule | 是 |
condition_rule | String | BODY | 自定义条件规则,当匹配类 型 match_type=3,该参数必 传。自定义条件规则遵从与 或运算公式。每个自动化条 件以其 order_num 为标识 码 eg:order_num 依次为 1, 2,3,业务场景为条件 1 与 2 同时满足,或者条件 3 满足 的情况下会触发自动化,则 表达式为:1&&2 |
conditions 参数说明
参数名 | 类型 | 参数类型 | 说明 | 是否必需 |
---|---|---|---|---|
entity_type | Integer | BODY | 条件类型,目前支持设备状态条件 entity_type=1 | 是 |
entity_id | String | BODY | 执行动作实体,当 entity_type=1 时,即设备 ID | 是 |
display | Object | BODY | 条件展示 | 是 |
order_num | Integer | BODY | 条件排序,从 1 开始 | 是 |
设备状态条件 display 参数说明
(参考设备支持联动的规格 status)
参数名 | 类型 | 参数类型 | 说明 | 是否必需 |
---|---|---|---|---|
code | String | BODY | 设备的状态编码 | 是 |
operator | String | BODY | 操作符 | 是 |
value | Object | BODY | 状态值 | 是 |
操作符operator 参数取值说明
类型 | opertaor |
---|---|
String | “==” |
String | “>”,“==”,“<” |
String | “==” |
preconditions 参数说明
前置限制条件,是仅当该规则内才执行,目前支持时间段限制
参数名 | 类型 | 说明 |
---|---|---|
cond_type | String | 暂支持时间段限制,固定为 timeCheck |
display | Object | 条件展示 |
前置条件display 参数说明
参数名 | 类型 | 说明 |
---|---|---|
start | String | 开始时间,默认为当天的某个时间点, 24 小时制,比 如"10:00" |
end | String | 结束时间,24 小时制,比如"22:00" |
loops | String | 由 0 和 1 组成的 7 位数字,0 表示不执行,1 表示执 行,第 1 位为周日,依次表示周一至周六,“0011000” 为每周二,周三执行 |
timezone_id | String | 时区 id,比如 Asia/Shanghai |
actions 参数说明
参数名 | 类型 | 说明 |
---|---|---|
entity_id | String | 执行动作实体,当前支持设备,即设备 ID |
executor_property | Object | 执行动作参数 |
action_executor | String | 执⾏动作类别,当前⽀支持:dpIssue |
action_executor 参数说明
action_executor 目前共支持5种动作,分别是 dpIssue、delay、ruleTrigger、ruleEnable、ruleDisable。其中delay不能作为最后一个动作,动作列表不能有两个以上delay动作。
action_executor | executor_property | entity_id | 说明 |
---|---|---|---|
dpIssue | {dpCode: dpValue} | 设备唯一标识 | 设备动作 |
delay | {“hours”: “1”,“minutes”: “15”,“seconds”: “0”} | delay | 延迟动作。0<=hours<=4, 0<=minutes<=59, 0<=seconds<=59 |
ruleTrigger | {} | 场景实例唯一标识 | 场景触发动作 |
ruleEnable | {} | 自动化实例唯一标识 | 自动化启用动作 |
ruleDisable | {} | 自动化实例唯一标识 | 自动化禁用动作 |
action_executor为dpIssue时,executor_property 参数说明
(参考设备支持联动的规格 functions)
key | value |
---|---|
功能 code | 功能 value |
参数名 | 类型 | 说明 |
---|---|---|
code | Integer | 响应码(详情见错误码章节),成功时为空 |
success | Boolean | 是否成功:(true:成功,false:失败) |
msg | String | 请求失败的信息,成功时为空 |
t | Long | 返回时间戳,13位 |
result | String | 自动化唯一标识 |
POST {url}/v1.0/osaas/rooms/122233******/automation
{
"conditions": [
{
"display": {
"code": "switch_1",
"operator": "==",
"value": true
},
"entity_id": "vdevo15725982******",
"entity_type": 1,
"order_num": 1
}
],
"actions": [
{
"action_executor": "delay",
"executor_property": {
"hours": "0",
"minutes": "0",
"seconds": "5"
}
},
{
"action_executor": "dpIssue",
"entity_id": "vdevo1572598******",
"executor_property": {
"switch_1": true
}
}
],
"match_type": 1,
"automation_name": "测试自动化"
}
前置条件示例
{
"preconditions": [
{
"display": {
"start": "10:00",
"end": "12:00",
"loops": "0010000",
"timezone_id": "Asia/Shanghai"
},
"cond_type": "timeCheck"
}
]
}
设备状态条件示例
{
"conditions": [
{
"display": {
"code": "switch_1",
"operator": "==",
"value": true
},
"entity_id": "vdevo157259******",
"entity_type": 1,
"order_num": 1
}
]
}
{
"success": true,
"result": "1112382396505******",
"t": 1566053034624
}
{
"code": 500,
"msg": "system error,please contact the admin",
"success": false,
"t": 1561378856383
}
调用该接口修改自动化
PUT /v1.0/osaas/rooms/{room_id}/automations/{automation_id}
参数名 | 类型 | 参数类型 | 说明 | 是否必需 |
---|---|---|---|---|
room_id | String | URI | 房屋唯一标识 | 是 |
automation_id | String | URI | 自动化唯一标识 | 是 |
automation_name | String | BODY | 自动化名称 | 是 |
conditions | Arrays | BODY | 条件列表 | 是 |
preconditions | Arrays | BODY | 前置条件,优先级最高 | 否 |
actions | Arrays | BODY | 动作列表 | 是 |
match_type | Integer | BODY | 匹配类型,1:任意条件满足 触发,2:全部条件满足触 发,3:自定义条件触发,需 设 定 相 关 逻 辑 运 算 参 数 condition_rule | 是 |
condition_rule | String | BODY | 自定义条件规则,当匹配类 型 match_type=3,该参数必 传。自定义条件规则遵从与 或运算公式。每个自动化条 件以其 order_num 为标识 码 eg:order_num 依次为 1, 2,3,业务场景为条件 1 与 2 同时满足,或者条件 3 满足 的情况下会触发自动化,则 表达式为:1&&2 |
conditions 参数说明
参数名 | 类型 | 参数类型 | 说明 | 是否必需 |
---|---|---|---|---|
entity_type | Integer | BODY | 条件类型,目前支持设备状态条件 entity_type=1 | 是 |
entity_id | String | BODY | 执行动作实体,当 entity_type=1 时,即设备 ID | 是 |
display | Object | BODY | 条件展示 | 是 |
order_num | Integer | BODY | 条件排序,从 1 开始 | 是 |
设备状态条件display 参数说明
(参考设备支持联动的规格 status)
参数名 | 类型 | 参数类型 | 说明 | 是否必需 |
---|---|---|---|---|
code | String | BODY | 设备的状态编码 | 是 |
operator | String | BODY | 操作符 | 是 |
value | Object | BODY | 状态值 | 是 |
操作符operator 参数取值说明
类型 | opertaor |
---|---|
String | “==” |
String | “>”,“==”,“<” |
String | “==” |
preconditions 参数说明
前置限制条件,是仅当该规则内才执行,目前支持时间段限制
参数名 | 类型 | 说明 |
---|---|---|
cond_type | String | 暂支持时间段限制,固定为 timeCheck |
display | Object | 条件展示 |
前置条件 display 参数说明
参数名 | 类型 | 说明 |
---|---|---|
start | String | 开始时间,默认为当天的某个时间点, 24 小时制,比 如"10:00" |
end | String | 结束时间,24 小时制,比如"22:00" |
loops | String | 由 0 和 1 组成的 7 位数字,0 表示不执行,1 表示执 行,第 1 位为周日,依次表示周一至周六,“0011000” 为每周二,周三执行 |
timezone_id | String | 时区 id,比如 Asia/Shanghai |
action_executor 参数说明
action_executor 目前共支持5种动作,分别是 dpIssue、delay、ruleTrigger、ruleEnable、ruleDisable。其中delay不能作为最后一个动作,动作列表不能有两个以上delay动作。
action_executor | executor_property | entity_id | 说明 |
---|---|---|---|
dpIssue | {dpCode: dpValue} | 设备唯一标识 | 设备动作 |
delay | {“hours”: “1”,“minutes”: “15”,“seconds”: “0”} | delay | 延迟动作。0<=hours<=4, 0<=minutes<=59, 0<=seconds<=59 |
ruleTrigger | {} | 场景实例唯一标识 | 场景触发动作 |
ruleEnable | {} | 自动化实例唯一标识 | 自动化启用动作 |
ruleDisable | {} | 自动化实例唯一标识 | 自动化禁用动作 |
action_executor为dpIssue时,executor_property 参数说明
(参考设备支持联动的规格 functions)
key | value |
---|---|
功能 code | 功能 value |
参数名 | 类型 | 说明 |
---|---|---|
code | Integer | 响应码(详情见错误码章节),成功时为空 |
success | Boolean | 是否成功:(true:成功,false:失败) |
msg | String | 请求失败的信息,成功时为空 |
t | Long | 返回时间戳,13位 |
result | Boolean | 操作结果 |
PUT {url}/v1.0/osaas/rooms/122233******/automations/53IYSXI3******
{
"conditions": [
{
"display": {
"code": "switch_1",
"operator": "==",
"value": true
},
"entity_id": "vdevo15725982******",
"entity_type": 1,
"order_num": 1
}
],
"actions": [
{
"action_executor": "delay",
"executor_property": {
"hours": "0",
"minutes": "0",
"seconds": "5"
}
},
{
"action_executor": "dpIssue",
"entity_id": "vdevo1572598******",
"executor_property": {
"switch_1": true
}
}
],
"match_type": 1,
"automation_name": "测试自动化"
}
前置条件示例
{
"preconditions": [
{
"display": {
"start": "10:00",
"end": "12:00",
"loops": "0010000",
"timezone_id": "Asia/Shanghai"
},
"cond_type": "timeCheck"
}
]
}
设备状态条件示例
{
"conditions": [
{
"display": {
"code": "switch_1",
"operator": "==",
"value": true
},
"entity_id": "vdevo157259******",
"entity_type": 1,
"order_num": 1
}
]
}
{
"success": true,
"result": true,
"t": 1566053034624
}
{
"code": 500,
"msg": "system error,please contact the admin",
"success": false,
"t": 1561378856383
}
调用该接口删除自动化
DELETE /v1.0/osaas/rooms/{room_id}/automations/{automation_id}
参数名 | 类型 | 参数类型 | 说明 | 是否必需 |
---|---|---|---|---|
room_id | String | URI | 房屋唯一标识 | 是 |
automation_id | String | URI | 自动化唯一标识 | 是 |
参数名 | 类型 | 说明 |
---|---|---|
code | Integer | 响应码(详情见错误码章节),成功时为空 |
success | Boolean | 是否成功:(true:成功,false:失败) |
msg | String | 请求失败的信息,成功时为空 |
t | Long | 返回时间戳,13位 |
result | Boolean | 操作结果 |
DELETE {url}/v1.0/osaas/rooms/1222333******/automations/53IY3g******
{
"success": true,
"result": true,
"t": 1566053034624
}
{
"code": 500,
"msg": "system error,please contact the admin",
"success": false,
"t": 1561378856383
}
调用该接口启用自动化
PUT /v1.0/osaas/rooms/{room_id}/automations/{automation_id}/enable
参数名 | 类型 | 参数类型 | 说明 | 是否必需 |
---|---|---|---|---|
room_id | String | URI | 房屋唯一标识 | 是 |
automation_id | String | URI | 自动化唯一标识 | 是 |
参数名 | 类型 | 说明 |
---|---|---|
code | Integer | 响应码(详情见错误码章节),成功时为空 |
success | Boolean | 是否成功:(true:成功,false:失败) |
msg | String | 请求失败的信息,成功时为空 |
t | Long | 返回时间戳,13位 |
result | Boolean | 操作结果 |
PUT {url}/v1.0/osaas/rooms/12223331******/automations/53IY3******/enable
{
"success": true,
"result": true,
"t": 1566053034624
}
{
"code": 500,
"msg": "system error,please contact the admin",
"success": false,
"t": 1561378856383
}
调用该接口停用自动化
PUT /v1.0/osaas/rooms/{room_id}/automations/{automation_id}/disable
参数名 | 类型 | 参数类型 | 说明 | 是否必需 |
---|---|---|---|---|
room_id | String | URI | 房屋唯一标识 | 是 |
automation_id | String | URI | 自动化唯一标识 | 是 |
参数名 | 类型 | 说明 |
---|---|---|
code | Integer | 响应码(详情见错误码章节),成功时为空 |
success | Boolean | 是否成功:(true:成功,false:失败) |
msg | String | 请求失败的信息,成功时为空 |
t | Long | 返回时间戳,13位 |
result | Boolean | 操作结果 |
PUT {url}/v1.0/osaas/rooms/12223311******/automations/53IY3******/disable
{
"success": true,
"result": true,
"t": 1566053034624
}
{
"code": 500,
"msg": "system error,please contact the admin",
"success": false,
"t": 1561378856383
}
以下为该接口常见的业务异常,更多的异常错误,请参见全局错误码。
错误码 | 说明 |
---|---|
500 | 系统错误 |
该内容对您有帮助吗?
是意见反馈该内容对您有帮助吗?
是意见反馈