更新时间:2021-07-30 04:03:17
action | 描述 |
---|---|
automation.add | 添加自动化 |
automation.edit | 修改自动化 |
automation.delete | 删除自动化 |
automation.listByHome | 查询家庭下的自动化列表 |
automation.info | 查询家庭下的某个自动化 |
automation.conditionsTrigger | 触发家庭下某个自动化的外部条件 |
automation.devicesByHome | 查询家庭下支持自动化的设备列表 |
automation.weatherConditions | 查询自动化支持的天气条件 |
automation.linkageByHome | 获取家庭支持的联动条件 |
automation.linkageByDevice | 获取设备支持的联动条件 |
automation.enable | 启用自动化 |
automation.disable | 停用自动化 |
接口说明
给某个家庭下添加自动化
接口地址
action: automation.add
params请求参数
参数名 | 类型 | 说明 | 是否必填 |
---|---|---|---|
home_id | Long | 用户家庭ID | 是 |
name | String | 自动化名称 | 是 |
background | String | 背景图片 | 是 |
conditions | List | 条件列表 | 是 |
preconditions | List | 前置条件,优先级最高 | 否 |
actions | List | 动作列表 | 是 |
match_type | Integer | 匹配类型,1:任意条件满足触发,2:全部条件满足触发,3:自定义条件触发,需设定相关逻辑运算参数condition_rule | 是 |
condition_rule | String | 自定义条件规则,当匹配类型match_type=3,该参数必传。自定义条件规则遵从与或运算公式。每个自动化条件以其order_num为标识码 例如,order_num依次为1,2,3,业务场景为条件1与2同时满足,或者条件3满足的情况下会触发自动化,则表达式为:1&&2 |
conditions 说明
参数名 | 类型 | 说明 | 是否必填 |
---|---|---|---|
entity_type | Integer | 条件类型,目前支持设备状态条件entity_type=1,外部条件 entity_type=15,天气条件entityType=3,定时条件entity_type=6 | 是 |
entity_id | String | 执行动作实体,当entity_type=1时,即设备ID,必传;当entity_type=15时,不传,由系统自动生成;当entityType=3,值为对应城市的id;当entity_type=6时,值固定为timer | 否 |
display | JSON | 条件展示 | 是 |
order_num | Integer | 条件排序,从1开始 | 是 |
设备状态条件display说明
参数名 | 类型 | 说明 | 是否必填 |
---|---|---|---|
code | String | 设备的statusCode | 是 |
operator | String | 操作符(见文末的code的数据类型和操作符的映射说明) | 是 |
value | String | code的取值 | 是 |
外部条件display说明
参数名 | 类型 | 说明 | 是否必填 |
---|---|---|---|
code | String | 外部条件的key | 是 |
operator | String | 操作符(见文末的code的数据类型和操作符的映射说明) | 是 |
value | Object | 外部条件的key对应code的取值 | 是 |
天气条件display说明
参数名 | 类型 | 说明 | 是否必填 |
---|---|---|---|
code | String | 天气条件对应的key,比如温度temp(获取所有key见接口”查询自动化支持的天气条件“) | 是 |
operator | String | 操作符(见文末的code的数据类型和操作符的映射说明) | 是 |
value | String | 天气条件对应的key对应code的取值 | 是 |
定时条件display说明
参数名 | 类型 | 说明 | 是否必填 |
---|---|---|---|
date | String | 触发日期,格式为yyyyMMdd, 比如"20191125" | 是 |
loops | String | 由0和1组成的7位数字,0表示不执行,1表示执行,第1位为周日,依次表示周一至周六,"0011000"为每周二,周三执行 | 是 |
time | String | 触发时间,24小时制,比如"14:00" | 是 |
timezone_id | String | 时区id,比如Asia/Shanghai | 是 |
preconditions说明
前置限制条件,是仅当该规则内才执行,目前支持时间段限制
参数名 | 类型 | 说明 | 是否必填 |
---|---|---|---|
cond_type | String | 暂支持时间段限制,固定为timeCheck | 是 |
display | JSON | 条件展示 | 是 |
前置条件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 说明
actions之设备说明
参数名 | 类型 | 说明 | 是否必填 |
---|---|---|---|
entity_id | String | 执行动作实体,即设备ID | 是 |
executor_property | Json | 执行动作参数 | 是 |
action_executor | String | 执行动作类别,固定为dpIssue | 是 |
actions之外部动作说明
参数名 | 类型 | 说明 | 是否必填 |
---|---|---|---|
executor_property | Json | 自定义外部动作 | 是 |
action_executor | String | 执行动作类别,固定为externalAction(外部动作) | 是 |
actions之延时说明
参数名 | 类型 | 说明 | 是否必填 |
---|---|---|---|
executor_property | Json | 执行动作参数 | 是 |
action_executor | String | 执行动作类别,固定为delay | 是 |
请求示例
{
"action": "automation.add",
"params": {
"home_id": 2422120,
"name":"测试自动化",
"background":"https://images.tuyacn.com/smart/rule/cover/bedroom.png",
"conditions":[
{
"display":{
"code":"switch_1",
"operator":"==",
"value":true
},
"entity_id":"vdevo158389535209173",
"entity_type":1,
"order_num":1
}
],
"actions":[
{
"action_executor":"dpIssue",
"entity_id":"vdevo158348104789998",
"executor_property":{
"switch": true
}
}
],
"match_type":1,
}
}
前置条件示例
{
"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":"vdevo157259825422309",
"entity_type":1,
"order_num":1
}
]
}
外部条件示例
{
"conditions":[
{
"display":{
"code":"test",
"operator":"==",
"value":"test"
},
"entity_type":15,
"order_num":1
}
]
}
天气条件示例
{
"conditions":[
{
"display":{
"code":"temp",
"operator":"==",
"value":"20"
},
"entity_id":"10",
"entity_type":3,
"order_num":1
}
]
}
定时条件示例
{
"conditions":[
{
"display":{
"date":"20200301",
"loops":"0000000",
"time":"14:00",
"timezone_id":"Asia/Shanghai"
},
"entity_id":"timer",
"entity_type":6,
"order_num":1
}
]
}
外部动作示例
{
"actions":[
{
"action_executor":"externalAction",
"executor_property":{
//自定义,将通过消息队列推送
}
}
]
}
响应参数
参数名 | 类型 | 说明 |
---|---|---|
code | Integer | 响应码 |
success | Boolean | 是否成功 true:成功 false:失败 |
msg | String | 请求失败的信息,成功时为空 |
t | Long | 返回时间戳,13位 |
result | String | 自动化ID |
响应成功示例
{
"success": true,
"t": 1541072348540,
"result":"53IYSXI3gEn2w3Oc"
}
响应失败示例
{
"success": false,
"code": 1100,
"msg": "param is empty",
"t": 1540954683193
}
code的数据类型和操作符的映射说明:
type | operator | 说明 |
---|---|---|
Boolean | “==” | |
Integer | “>”,“==”,“<” | |
Enum | “==” |
接口说明
修改某个家庭下的自动化
接口地址
action: automation.edit
params请求参数
参数名 | 类型 | 说明 | 是否必填 |
---|---|---|---|
home_id | Long | 用户家庭ID | 是 |
automation_id | String | 自动化id | 是 |
name | String | 自动化名称 | 是 |
background | String | 背景图片 | 是 |
conditions | List | 条件列表 | 是 |
preconditions | List | 前置条件,优先级最高 | 否 |
actions | List | 动作列表 | 是 |
match_type | Integer | 匹配类型,1:任意条件满足触发,2:全部条件满足触发,3:自定义条件触发,需设定相关逻辑运算参数condition_rule | 是 |
condition_rule | String | 自定义条件规则,当匹配类型match_type=3,该参数必传。自定义条件规则遵从与或运算公式。每个自动化条件以其order_num为标识码 例如,order_num依次为1,2,3,业务场景为条件1与2同时满足,或者条件3满足的情况下会触发自动化,则表达式为:1&&2 |
conditions 说明
参数名 | 类型 | 说明 | 是否必填 |
---|---|---|---|
entity_type | Integer | 条件类型,目前支持设备状态条件entity_type=1,外部条件 entity_type=15,天气条件entityType=3,定时条件entity_type=6 | 是 |
entity_id | String | 执行动作实体,当entity_type=1时,即设备ID,必传;当entity_type=15时,不传,由系统自动生成;当entityType=3,值为对应城市的id;当entity_type=6时,值固定为timer | 否 |
display | JSON | 条件展示 | 是 |
order_num | Integer | 条件排序,从1开始 | 是 |
设备状态条件display说明
参数名 | 类型 | 说明 | 是否必填 |
---|---|---|---|
code | String | 设备的statusCode | 是 |
operator | String | 操作符(见文末的code的数据类型和操作符的映射说明) | 是 |
value | String | code的取值 | 是 |
外部条件display说明
参数名 | 类型 | 说明 | 是否必填 |
---|---|---|---|
code | String | 外部条件的key | 是 |
operator | String | 操作符(见文末的code的数据类型和操作符的映射说明) | 是 |
value | String | 外部条件的key对应code的取值 | 是 |
天气条件display说明
参数名 | 类型 | 说明 | 是否必填 |
---|---|---|---|
code | String | 天气条件对应的key,比如温度temp | 是 |
operator | String | 操作符(见文末的code的数据类型和操作符的映射说明) | 是 |
value | Object | 天气条件对应的key对应code的取值 | 是 |
定时条件display说明
参数名 | 类型 | 说明 | 是否必填 |
---|---|---|---|
date | String | 触发日期,格式为yyyyMMdd, 比如"20191125" | 是 |
loops | String | 由0和1组成的7位数字,0表示不执行,1表示执行,第1位为周日,依次表示周一至周六,"0011000"为每周二,周三执行 | 是 |
time | String | 触发时间,24小时制,比如"14:00" | 是 |
timezone_id | String | 时区id,比如Asia/Shanghai | 是 |
preconditions说明
前置限制条件,是仅当该规则内才执行,目前支持时间段限制
参数名 | 类型 | 说明 | 是否必填 |
---|---|---|---|
cond_type | String | 暂支持时间段限制,固定为timeCheck | 是 |
display | JSON | 条件展示 | 是 |
前置条件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 说明
actions之设备说明
参数名 | 类型 | 说明 | 是否必填 |
---|---|---|---|
entity_id | String | 执行动作实体,即设备ID | 是 |
executor_property | Json | 执行动作参数 | 是 |
action_executor | String | 执行动作类别,固定为dpIssue | 是 |
actions之外部动作说明
参数名 | 类型 | 说明 | 是否必填 |
---|---|---|---|
executor_property | Json | 自定义外部动作 | 是 |
action_executor | String | 执行动作类别,固定为externalAction(外部动作) | 是 |
actions之延时说明
参数名 | 类型 | 说明 | 是否必填 |
---|---|---|---|
executor_property | Json | 执行动作参数 | 是 |
action_executor | String | 执行动作类别,固定为delay | 是 |
请求示例
{
"action": "automation.edit",
"params": {
"home_id": 2422120,
"automation_id": "53IYSXI3gEn2w3Oc",
"name":"测试自动化",
"background":"https://images.tuyacn.com/smart/rule/cover/bedroom.png",
"conditions":[
{
"display":{
"code":"switch_1",
"operator":"==",
"value":true
},
"entity_id":"vdevo158389535209173",
"entity_type":1,
"order_num":1
}
],
"actions":[
{
"action_executor":"dpIssue",
"entity_id":"vdevo158348104789998",
"executor_property":{
"switch": true
}
}
],
"match_type":1,
}
}
前置条件示例
{
"preconditions":[
{
"display":{
"start":"10:00",
"end":"12:00",
"loops":"0000000",
"timezone_id":"Asia/Shanghai"
},
"cond_type":"timeCheck"
}
]
}
设备状态条件示例
{
"conditions":[
{
"display":{
"code":"switch_1",
"operator":"==",
"value":true
},
"entity_id":"vdevo157259825422309",
"entity_type":1,
"order_num":1
}
]
}
外部条件示例
{
"conditions":[
{
"display":{
"code":"test",
"operator":"==",
"value":"test"
},
"entity_type":15,
"order_num":1
}
]
}
天气条件示例
{
"conditions":[
{
"display":{
"code":"temp",
"operator":"==",
"value":"20"
},
"entity_id":"10",
"entity_type":3,
"order_num":1
}
]
}
定时条件示例
{
"conditions":[
{
"display":{
"date":"20200301",
"loops":"0000000",
"time":"14:00",
"timezone_id":"Asia/Shanghai"
},
"entity_id":"timer",
"entity_type":6,
"order_num":1
}
]
}
外部动作示例
{
"actions":[
{
"action_executor":"externalAction",
"executor_property":{
//自定义,将通过消息队列推送
}
}
]
}
延时动作示例
{
"action_executor":"delay",
"executor_property":{
"hours":"0",
"minutes": "0",
"seconds": "5"
}
}
响应参数
参数名 | 类型 | 说明 |
---|---|---|
code | Integer | 响应码 |
success | Boolean | 是否成功 true:成功 false:失败 |
msg | String | 请求失败的信息,成功时为空 |
t | Long | 返回时间戳,13位 |
result | Boolean | 修改成功返回true |
响应成功示例
{
"success": true,
"t": 1541072348540,
"result": true
}
响应失败示例
{
"success": false,
"code": 1100,
"msg": "param is empty",
"t": 1540954683193
}
code的数据类型和操作符的映射说明:
type | operator | 说明 |
---|---|---|
Boolean | “==” | |
Integer | “>”,“==”,“<” | |
Enum | “==” |
接口说明
删除某个家庭下的自动化
接口地址
action: automation.delete
params请求参数
参数名 | 类型 | 说明 | 是否必填 |
---|---|---|---|
home_id | Long | 用户家庭ID | 是 |
automation_id | String | 自动化id | 是 |
请求示例
{
"action": "automation.delete",
"params": {
"home_id": 2422120,
"automation_id": "53IYSXI3gEn2w3Oc"
}
}
响应参数
参数名 | 类型 | 说明 |
---|---|---|
code | Integer | 响应码 |
success | Boolean | 是否成功 true:成功 false:失败 |
msg | String | 请求失败的信息,成功时为空 |
t | Long | 返回时间戳,13位 |
result | Boolean | 自动化删除成功,返回true |
响应成功示例
{
"success": true,
"t": 1541072348540,
"result":true
}
响应失败示例
{
"success": false,
"code": 1100,
"msg": "param is empty",
"t": 1540954683193
}
接口说明
查询家庭下的自动化列表
接口地址
action: automation.listByHome
params请求参数
参数名 | 类型 | 说明 | 是否必填 |
---|---|---|---|
home_id | Long | 用户家庭ID | 是 |
请求示例
{
"action": "automation.listByHome",
"params": {
"home_id": 2422120
}
}
响应参数
参数名 | 类型 | 说明 |
---|---|---|
code | Integer | 响应码 |
success | Boolean | 是否成功 true:成功 false:失败 |
msg | String | 请求失败的信息,成功时为空 |
t | Long | 返回时间戳,13位 |
result | List | 返回结果说明 |
result 说明
参数名 | 类型 | 说明 |
---|---|---|
automation_id | String | 自动化id |
name | String | 自动化名称 |
background | String | 背景图片 |
conditions | List | 条件列表 |
actions | List | 动作列表 |
match_type | Integer | 匹配类型,1:任意条件满足触发,2:全部条件满足触发 |
conditions 说明
参数名 | 类型 | 说明 | 是否必填 |
---|---|---|---|
entity_type | Integer | 条件类型,目前只支持entity_type=1 | 是 |
entity_id | String | 执行动作实体,当前支持:设备,即设备ID | 是 |
display | JSON | 条件展示,目前只支持entity_type=1 | 是 |
order_num | Integer | 条件排序,从1开始 | 是 |
display 说明
参数名 | 类型 | 说明 | 是否必填 |
---|---|---|---|
code | String | 设备的statusCode | 是 |
operator | String | 操作符(见文末的code的数据类型和操作符的映射说明) | 是 |
value | String | code的取值 | 是 |
actions 说明
参数名 | 类型 | 说明 | 是否必填 |
---|---|---|---|
entity_id | String | 执行动作实体,当前支持:设备,即设备ID | 是 |
executor_property | Json | 执行动作参数 | 是 |
action_executor | String | 执行动作类别,当前支持:dpIssue | 是 |
响应成功示例
{
"result":[
{
"actions":[
{
"action_executor":"dpIssue",
"entity_id":"vdevo157259825422309",
"executor_property":{
"switch_1":true
}
}
],
"automation_id":"p2aWOkEOe2RzATHL",
"background":"https://images.tuyacn.com/smart/rule/cover/bedroom.png",
"conditions":[
{
"display":{
"code":"switch_1",
"operator":"==",
"value":true
},
"entity_id":"vdevo157259825422309",
"entity_type":1,
"order_num":1
}
],
"match_type":1,
"name":"测试自动化"
},
{
"automation_id":"L07BQVabdqwFPT9K",
"background":"https://images.tuyacn.com/smart/rule/cover/house6.png",
"conditions":[
{
"display":{
"code":"battery_percentage",
"operator":"<",
"value":255
},
"entity_id":"vdevo156958314001174",
"entity_type":1,
"order_num":1
}
],
"match_type":1,
"name":"自动化测试1"
}
],
"success":true,
"t":1572936751228
}
响应失败示例
{
"success": false,
"code": 1100,
"msg": "param is empty",
"t": 1540954683193
}
code的数据类型和操作符的映射说明:
type | operator | 说明 |
---|---|---|
Boolean | “==” | |
Integer | “>”,“==”,“<” | |
Enum | “==” |
接口说明
查询家庭下的某个自动化
接口地址
action: automation.info
params请求参数
参数名 | 类型 | 说明 | 是否必填 |
---|---|---|---|
home_id | Long | 用户家庭ID | 是 |
automation_id | String | 自动化id | 是 |
请求示例
{
"action": "automation.info",
"params": {
"home_id": 2422120,
"automation_id":"L07BQVabdqwFPT9K"
}
}
响应参数
参数名 | 类型 | 说明 |
---|---|---|
code | Integer | 响应码 |
success | Boolean | 是否成功 true:成功 false:失败 |
msg | String | 请求失败的信息,成功时为空 |
t | Long | 返回时间戳,13位 |
result | List | 返回结果说明 |
result 说明
参数名 | 类型 | 说明 |
---|---|---|
automation_id | String | 自动化id |
name | String | 自动化名称 |
background | String | 背景图片 |
conditions | List | 条件列表 |
actions | List | 动作列表 |
match_type | Integer | 匹配类型,1:任意条件满足触发,2:全部条件满足触发 |
conditions 说明
参数名 | 类型 | 说明 | 是否必填 |
---|---|---|---|
entity_type | Integer | 条件类型,目前只支持entity_type=1 | 是 |
entity_id | String | 执行动作实体,当前支持:设备,即设备ID | 是 |
display | JSON | 条件展示,目前只支持entity_type=1 | 是 |
order_num | Integer | 条件排序,从1开始 | 是 |
display 说明
参数名 | 类型 | 说明 | 是否必填 |
---|---|---|---|
code | String | 设备的statusCode | 是 |
operator | String | 操作符(见文末的code的数据类型和操作符的映射说明) | 是 |
value | String | code的取值 | 是 |
actions 说明
参数名 | 类型 | 说明 | 是否必填 |
---|---|---|---|
entity_id | String | 执行动作实体,当前支持:设备,即设备ID | 是 |
executor_property | Json | 执行动作参数 | 是 |
action_executor | String | 执行动作类别,当前支持:dpIssue | 是 |
响应成功示例
{
"result":[
{
"actions":[
{
"action_executor":"dpIssue",
"entity_id":"vdevo157259825422309",
"executor_property":{
"switch_1":true
}
}
],
"automation_id":"p2aWOkEOe2RzATHL",
"background":"https://images.tuyacn.com/smart/rule/cover/bedroom.png",
"conditions":[
{
"display":{
"code":"switch_1",
"operator":"==",
"value":true
},
"entity_id":"vdevo157259825422309",
"entity_type":1,
"order_num":1
}
],
"match_type":1,
"name":"测试自动化"
},
{
"automation_id":"L07BQVabdqwFPT9K",
"background":"https://images.tuyacn.com/smart/rule/cover/house6.png",
"conditions":[
{
"display":{
"code":"battery_percentage",
"operator":"<",
"value":255
},
"entity_id":"vdevo156958314001174",
"entity_type":1,
"order_num":1
}
],
"match_type":1,
"name":"自动化测试1"
}
],
"success":true,
"t":1572936751228
}
响应失败示例
{
"success": false,
"code": 1100,
"msg": "param is empty",
"t": 1540954683193
}
code的数据类型和操作符的映射说明:
type | operator | 说明 |
---|---|---|
Boolean | “==” | |
Integer | “>”,“==”,“<” | |
Enum | “==” |
接口说明
触发家庭下某个自动化的外部条件
接口地址
action: automation.conditionsTrigger
params请求参数
参数名 | 类型 | 说明 | 是否必填 |
---|---|---|---|
home_id | Long | 用户家庭ID | 是 |
automation_id | String | 自动化id | 是 |
conditions | List | 条件列表 | 是 |
conditions 说明
参数名 | 类型 | 说明 | 是否必填 |
---|---|---|---|
entity_id | String | 外部条件对应ID | 是 |
display | JSON | 条件 | 是 |
display 说明
参数名 | 类型 | 说明 | 是否必填 |
---|---|---|---|
code | String | 设备的statusCode | 是 |
value | String | code的取值 | 是 |
请求示例
{
"action": "automation.conditionsTrigger",
"params": {
"home_id": 2422120,
"automation_id": "53IYSXI3gEn2w3Oc",
"conditions": [
{
"entity_id": "c9a5a524-d973-4b59-9390-0dcda0f172ec",
"display": {
"code":"test",
"value":"test"
}
}]
}
}
响应参数
参数名 | 类型 | 说明 |
---|---|---|
code | Integer | 响应码(详情见错误码章节),成功时为空 |
success | Boolean | 是否成功 true:成功 false:失败 |
msg | String | 请求失败的信息,成功时为空 |
t | Long | 返回时间戳,13位 |
result | String | 触发成功,返回true |
响应成功示例
{
"success": true,
"t": 1541072348540,
"result": true
}
响应失败示例
{
"success": false,
"code": 1100,
"msg": "param is empty",
"t": 1540954683193
}
接口说明
查询家庭下支持自动化的设备列表
接口地址
action: automation.devicesByHome
params请求参数
参数名 | 类型 | 说明 | 是否必填 |
---|---|---|---|
home_id | Long | 用户家庭ID | 是 |
type | String | 支持的类型,值为condition,表示支持条件; 值为action,表示支持动作;不传时为两者之集合 | 否 |
请求示例
{
"action": "automation.devicesByHome",
"params": {
"home_id": 2422120,
"type": "condition"
}
}
响应参数
参数名 | 类型 | 说明 |
---|---|---|
code | Integer | 响应码(详情见错误码章节),成功时为空 |
success | Boolean | 是否成功 true:成功 false:失败 |
msg | String | 请求失败的信息,成功时为空 |
t | Long | 返回时间戳,13位 |
result | List | 返回结果说明 |
result 说明
参数名 | 类型 | 说明 |
---|---|---|
device_id | String | 设备编号 |
uuid | String | 设备唯一标识 |
name | String | 名称 |
home_id | String | 家庭ID |
product_id | String | 产品id |
响应成功示例
{
"result":[
{
"id":"vedo1234456",
"uuid":"asdfghnbvcxwert",
"name":"测试设备",
"product_id":"r4567543dvbn",
"home_id":"2422120"
}
],
"success":true,
"t":1572936751228
}
响应失败示例
{
"success": false,
"code": 1100,
"msg": "param is empty",
"t": 1540954683193
}
接口说明
查询自动化支持的天气条件
接口地址
action: automation.weatherConditions
params请求参数
无
请求示例
{
"action": "automation.weatherConditions"
}
响应参数
参数名 | 类型 | 说明 |
---|---|---|
code | Integer | 响应码(详情见错误码章节),成功时为空 |
success | Boolean | 是否成功 true:成功 false:失败 |
msg | String | 请求失败的信息,成功时为空 |
t | Long | 返回时间戳,13位 |
result | List | 返回结果说明 |
result 说明
参数名 | 类型 | 说明 |
---|---|---|
category | String | 类别 |
category_name | String | 类别名称 |
operators | String | 操作符 |
property | JSON | 类别属性 |
响应成功示例
{
"result":[
{
"category":"temp",
"category_name":"温度",
"operators":"[\"<\",\"==\",\">\"]",
"property":{
"unit": "℃",
"min": -40,
"max": 40,
"step": 1,
"type": "value"
},
}
],
"success":true,
"t":1572936751228
}
响应失败示例
{
"success": false,
"code": 1100,
"msg": "param is empty",
"t": 1540954683193
}
接口说明
根据家庭ID获取联动条件或执行动作的标准功能点
接口地址
action: automation.linkageByHome
params请求参数
参数名 | 类型 | 说明 | 是否必填 |
---|---|---|---|
home_id | String | 家庭ID | 是 |
请求示例
{
"action": "automation.linkageByHome",
"params": {
"home_id": 2422120
}
}
响应参数
参数名 | 类型 | 说明 |
---|---|---|
code | Integer | 响应码 |
success | Boolean | 是否成功 true:成功 false:失败 |
msg | String | 请求失败的信息,成功时为空 |
t | Long | 返回时间戳,13位 |
result | List | 返回结果说明 |
result 说明
参数名 | 类型 | 说明 |
---|---|---|
device_id | String | 自动化id |
functions | List | 标准指令code,可用于动作执行 |
status | List | 标准状态code,可用于条件触发 |
functions 说明
参数名 | 类型 | 说明 |
---|---|---|
code | String | 标准下发指令code |
name | String | code名称 |
type | String | 下发数据类型,目前支持三种类型(Boolean,Integer,Enum) |
values | Json | code对应的取值范围 |
status 说明
参数名 | 类型 | 说明 |
---|---|---|
code | String | 标准上报状态code |
name | String | code名称 |
type | String | 上报数据类型,目前支持三种类型(Boolean,Integer,Enum) |
values | Json | code对应的取值范围 |
响应成功示例
{
"success": true,
"t": 1541072348540,
"result": [
{
"device_id": "0120090568c63a89cb34",
"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",
"scene",
"scene_1",
"scene_2",
"scene_3",
"scene_4"
],
"type": "Enum"
}
}
]
}
]
}
响应失败示例
{
"success": false,
"code": 1100,
"msg": "param is empty",
"t": 1540954683193
}
接口说明
根据设备ID获取联动条件或执行动作的标准功能点
接口地址
action: automation.linkageByDevice
params请求参数
参数名 | 类型 | 说明 | 是否必填 |
---|---|---|---|
device_id | String | 设备ID | 是 |
请求示例
{
"action": "automation.linkageByDevice",
"params": {
"device_id": "vdevo158348104789998"
}
}
响应参数
参数名 | 类型 | 说明 |
---|---|---|
code | Integer | 响应码 |
success | Boolean | 是否成功 true:成功 false:失败 |
msg | String | 请求失败的信息,成功时为空 |
t | Long | 返回时间戳,13位 |
result | Object | 返回结果说明 |
result 说明
参数名 | 类型 | 说明 |
---|---|---|
device_id | String | 设备ID |
functions | List | 标准指令code,可用于动作执行 |
status | List | 标准状态code,可用于条件触发 |
functions 说明
参数名 | 类型 | 说明 |
---|---|---|
code | String | 标准下发指令code |
name | String | code名称 |
type | String | 下发数据类型,目前支持三种类型(Boolean,Integer,Enum) |
values | Json | code对应的取值范围 |
status 说明
参数名 | 类型 | 说明 |
---|---|---|
code | String | 标准上报状态code |
name | String | code名称 |
type | String | 上报数据类型,目前支持三种类型(Boolean,Integer,Enum) |
values | Json | code对应的取值范围 |
响应成功示例
{
"success": true,
"t": 1541072348540,
"result": {
"device_id": "0120090568c63a89cb34",
"functions": [
{
"name": "亮度",
"code": "bright_value",
"type": "Integer",
"values": {
"max":255,
"min":25,
"scale":0,
"step":1,
"type":"Integer",
"unit":""
}
},
{
"name": "开关",
"code": "switch_led",
"type": "Boolean",
"values": {
"type": "Boolean"
}
}
],
"status": [
{
"name": "模式",
"code": "work_mode",
"type": "Enum",
"values": {
"range": [
"white",
"colour",
"scene",
"scene_1",
"scene_2",
"scene_3",
"scene_4"
],
"type": "Enum"
}
}
]
}
}
响应失败示例
{
"success": false,
"code": 1100,
"msg": "param is empty",
"t": 1540954683193
}
接口说明
启用自动化
接口地址
action: automation.enable
params请求参数
参数名 | 类型 | 说明 | 是否必填 |
---|---|---|---|
home_id | Long | 家庭ID | 是 |
automation_id | String | 自动化ID | 是 |
返回参数
参数名 | 类型 | 说明 |
---|---|---|
code | Integer | 响应码(详情见错误码章节),成功时为空 |
success | Boolean | 是否成功 true:成功 false:失败 |
msg | String | 请求失败的信息,成功时为空 |
t | Long | 返回时间戳,13位 |
result | Boolean | 返回结果 |
请求示例
{
"action": "automation.enable",
"params": {
"home_id": 2422120,
"automation_id": "53IYSXI3gEn2w3Oc"
}
}
响应示例
{
"success": true,
"t": 1541072348540,
"result": true
}
错误码
以下为该接口常见的业务异常,更多的异常错误,请参见全局错误码。
错误码 | 说明 |
---|---|
500 | 系统错误 |
接口说明
停用自动化
接口地址
action: automation.disable
请求参数
参数名 | 类型 | 说明 | 是否必填 |
---|---|---|---|
home_id | Long | 家庭ID | 是 |
automation_id | String | 自动化ID | 是 |
返回参数:
参数名 | 类型 | 说明 |
---|---|---|
code | Integer | 响应码(详情见错误码章节),成功时为空 |
success | Boolean | 是否成功 true:成功 false:失败 |
msg | String | 请求失败的信息,成功时为空 |
t | Long | 返回时间戳,13位 |
result | Boolean | 返回结果 |
请求示例
{
"action": "automation.disable",
"params": {
"home_id": 2422120,
"automation_id": "53IYSXI3gEn2w3Oc"
}
}
响应示例
{
"success": true,
"t": 1541072348540,
"result": true
}
错误码
以下为该接口常见的业务异常,更多的异常错误,请参见全局错误码。
错误码 | 说明 |
---|---|
500 | 系统错误 |
该内容对您有帮助吗?
是意见反馈该内容对您有帮助吗?
是意见反馈