场景管理API
获取场景列表
接口地址
POST /api/v1.0/invoke/open-ability/method/hotel-commands
请求参数
| 参数名 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| Content-Type | String | Header | 是 | 内容类型,值为application/json |
| Accept | String | Header | 是 | 接受类型,值为application/json |
| Authorization | String | Header | 是 | Bearer认证,访问令牌 |
| command | String | Body | 是 | 命令名称 |
| id | String | Body | 是 | 命令ID |
| param | Object<param> | Body | 是 | 命令参数 |
param说明
| 参数名 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| page_size | Integer | Body | 是 | 每页数量 |
| page_index | Integer | Body | 是 | 当前页数 |
返回参数
| 参数名 | 类型 | 位置 | 说明 |
|---|---|---|---|
| Content-Type | String | Header | 内容类型,值为application/json |
| success | Boolean | Body | 判断请求是否成功 true:成功 false:失败 |
| timestamp | Integer | Body | 时间戳 |
| result | []Object<result> | Body | 返回结果 |
result说明
| 参数名 | 类型 | 位置 | 说明 |
|---|---|---|---|
| scene_id | String | Body | 场景ID |
| scene_name | String | Body | 场景名称 |
| enable_auto | Boolean | Body | 判断是否启用自动化 true:启用 false:禁用 |
请求示例
POST /api/v1.0/invoke/open-ability/method/hotel-commands
Content-Type: application/json
Accept: application/json
Authorization: Bearer ac45e846ca23ab42c9ae469d988ae32a9
{
"command": "get_scene_list",
"id": "c45e846ca23ab42c9ae469d988ae32a96",
"param": {
"page_size": 1,
"page_index": 1
}
}
成功返回示例
状态码:200
Content-Type: application/json
{
"success": true,
"timestamp": 1540869200562,
"result": [
{
"scene_id": "s8b5a73f8dd84abaa94dcs248be49b0db",
"scene_name": "my scene",
"enable_auto": true
}
]
}
失败返回示例
见 接口失败返回
获取场景信息
接口地址
POST /api/v1.0/invoke/open-ability/method/hotel-commands
请求参数
| 参数名 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| Content-Type | String | Header | 是 | 内容类型,值为application/json |
| Accept | String | Header | 是 | 接受类型,值为application/json |
| Authorization | String | Header | 是 | Bearer认证,访问令牌 |
| command | String | Body | 是 | 命令名称 |
| id | String | Body | 是 | 命令ID |
| param | Object<param> | Body | 是 | 命令参数 |
param说明
| 参数名 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| scene_id | String | Body | 是 | 场景ID |
返回参数
| 参数名 | 类型 | 位置 | 说明 |
|---|---|---|---|
| Content-Type | String | Header | 内容类型,值为application/json |
| success | Boolean | Body | 判断请求是否成功 true:成功 false:失败 |
| timestamp | Integer | Body | 时间戳 |
| result | Object<result> | Body | 返回结果 |
result说明
| 参数名 | 类型 | 位置 | 说明 |
|---|---|---|---|
| scene_name | String | Body | 场景名称 |
| triggers | []Object<trigger> | Body | 触发器信息 |
| actions | []Object<action> | Body | 动作信息 |
trigger说明
| 参数名 | 类型 | 位置 | 说明 |
|---|---|---|---|
| trigger_config | String | Body | 触发器配置,见 场景触发器配置 |
| trigger_type | String | Body | 触发器类型,见 场景触发器配置 |
| room_tag_id | String | Body | 房间标签ID |
action说明
| 参数名 | 类型 | 位置 | 说明 |
|---|---|---|---|
| action_config | String | Body | 动作配置,见 场景动作配置 |
| ability_type | String | Body | 能力类型 |
| action_type | String | Body | 动作类型,见 场景动作配置 |
| attribute | Object | Body | 附加属性,见 标准物模型 |
请求示例
POST /api/v1.0/invoke/open-ability/method/hotel-commands
Content-Type: application/json
Accept: application/json
Authorization: Bearer ac45e846ca23ab42c9ae469d988ae32a9
{
"command": "get_scene_info",
"id": "c45e846ca23ab42c9ae469d988ae32a96",
"param": {
"scene_id": "s8b5a73f8dd84abaa94dcs248be49b0db"
}
}
成功返回示例
状态码:200
Content-Type: application/json
{
"success": true,
"timestamp": 1540869200562,
"result": [
{
"scene_name": "my scene",
"triggers": [
{
"trigger_config": "hotel",
"trigger_type": "check_in",
"room_tag_id": ""
}
],
"actions": [
{
"action_config": "device",
"ability_type": "light",
"action_type": "turn_all_on"
}
]
}
]
}
失败返回示例
见 接口失败返回
创建场景信息
接口地址
POST /api/v1.0/invoke/open-ability/method/hotel-commands
请求参数
| 参数名 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| Content-Type | String | Header | 是 | 内容类型,值为application/json |
| Accept | String | Header | 是 | 接受类型,值为application/json |
| Authorization | String | Header | 是 | Bearer认证,访问令牌 |
| command | String | Body | 是 | 命令名称 |
| id | String | Body | 是 | 命令ID |
| param | Object<param> | Body | 是 | 命令参数 |
param说明
| 参数名 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| scene_name | String | Body | 是 | 场景名称 |
| triggers | []Object<trigger> | Body | 是 | 触发器信息 |
| actions | []Object<action> | Body | 是 | 动作信息 |
trigger说明
| 参数名 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| trigger_config | String | Body | 是 | 触发器配置,见 场景触发器配置 |
| trigger_type | String | Body | 是 | 触发器类型,见 场景触发器配置 |
| room_tag_id | String | Body | 否 | 房间标签ID |
action说明
| 参数名 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| action_config | String | Body | 是 | 动作配置,见 场景动作配置 |
| ability_type | String | Body | 是 | 能力类型 |
| action_type | String | Body | 是 | 动作类型,见 场景动作配置 |
| attribute | Object | Body | 否 | 附加属性,见 标准物模型 |
返回参数
| 参数名 | 类型 | 位置 | 说明 |
|---|---|---|---|
| Content-Type | String | Header | 内容类型,值为application/json |
| success | Boolean | Body | 判断请求是否成功 true:成功 false:失败 |
| timestamp | Integer | Body | 时间戳 |
| result | Object<result> | Body | 返回结果 |
result说明
| 参数名 | 类型 | 位置 | 说明 |
|---|---|---|---|
| scene_id | String | Body | 场景ID |
请求示例
POST /api/v1.0/invoke/open-ability/method/hotel-commands
Content-Type: application/json
Accept: application/json
Authorization: Bearer ac45e846ca23ab42c9ae469d988ae32a9
{
"command": "create_scene_info",
"id": "c45e846ca23ab42c9ae469d988ae32a96",
"param": {
"scene_name": "test",
"triggers": [
{
"trigger_config": "hotel",
"trigger_type": "check_in"
}
],
"actions": [
{
"action_config": "device",
"ability_type": "light",
"action_type": "turn_all_on"
}
]
}
}
成功返回示例
状态码:200
Content-Type: application/json
{
"success": true,
"timestamp": 1540869200562,
"result": {
"scene_id": "sr31adc223cc4b3bedb6bd4742dedcfa5"
}
}
失败返回示例
见 接口失败返回
更新场景信息
接口地址
POST /api/v1.0/invoke/open-ability/method/hotel-commands
请求参数
| 参数名 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| Content-Type | String | Header | 是 | 内容类型,值为application/json |
| Accept | String | Header | 是 | 接受类型,值为application/json |
| Authorization | String | Header | 是 | Bearer认证,访问令牌 |
| command | String | Body | 是 | 命令名称 |
| id | String | Body | 是 | 命令ID |
| param | Object<param> | Body | 是 | 命令参数 |
param说明
| 参数名 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| scene_id | String | Body | 是 | 场景ID |
| scene_name | String | Body | 是 | 场景名称 |
| triggers | []Object<trigger> | Body | 是 | 触发器信息 |
| actions | []Object<action> | Body | 是 | 动作信息 |
trigger说明
| 参数名 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| trigger_config | String | Body | 是 | 触发器配置,见 场景触发器配置 |
| trigger_type | String | Body | 是 | 触发器类型,见 场景触发器配置 |
| room_tag_id | String | Body | 否 | 房间标签ID |
action说明
| 参数名 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| action_config | String | Body | 是 | 动作配置,见 场景动作配置 |
| ability_type | String | Body | 是 | 能力类型 |
| action_type | String | Body | 是 | 动作类型,见 场景动作配置 |
| attribute | Object | Body | 否 | 附加属性,见 标准物模型 |
返回参数
| 参数名 | 类型 | 位置 | 说明 |
|---|---|---|---|
| Content-Type | String | Header | 内容类型,值为application/json |
| success | Boolean | Body | 判断请求是否成功 true:成功 false:失败 |
| timestamp | Integer | Body | 时间戳 |
| result | Object | Body | 返回结果 |
请求示例
POST /api/v1.0/invoke/open-ability/method/hotel-commands
Content-Type: application/json
Accept: application/json
Authorization: Bearer ac45e846ca23ab42c9ae469d988ae32a9
{
"command": "update_scene_info",
"id": "c45e846ca23ab42c9ae469d988ae32a96",
"param": {
"scene_id": "sr31adc223cc4b3bedb6bd4742dedcfa5",
"scene_name": "test",
"triggers": [
{
"trigger_config": "hotel",
"trigger_type": "check_in"
}
],
"actions": [
{
"action_config": "device",
"ability_type": "light",
"action_type": "turn_all_on"
}
]
}
}
成功返回示例
状态码:200
Content-Type: application/json
{
"success": true,
"timestamp": 1540869200562,
"result": {}
}
失败返回示例
见 接口失败返回
删除场景信息
接口地址
POST /api/v1.0/invoke/open-ability/method/hotel-commands
请求参数
| 参数名 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| Content-Type | String | Header | 是 | 内容类型,值为application/json |
| Accept | String | Header | 是 | 接受类型,值为application/json |
| Authorization | String | Header | 是 | Bearer认证,访问令牌 |
| command | String | Body | 是 | 命令名称 |
| id | String | Body | 是 | 命令ID |
| param | Object<param> | Body | 是 | 命令参数 |
param说明
| 参数名 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| scene_id | String | Body | 是 | 场景ID |
返回参数
| 参数名 | 类型 | 位置 | 说明 |
|---|---|---|---|
| Content-Type | String | Header | 内容类型,值为application/json |
| success | Boolean | Body | 判断请求是否成功 true:成功 false:失败 |
| timestamp | Integer | Body | 时间戳 |
| result | Object | Body | 返回结果 |
请求示例
POST /api/v1.0/invoke/open-ability/method/hotel-commands
Content-Type: application/json
Accept: application/json
Authorization: Bearer ac45e846ca23ab42c9ae469d988ae32a9
{
"command": "delete_scene_info",
"id": "c45e846ca23ab42c9ae469d988ae32a96",
"param": {
"scene_id": "s8b5a73f8dd84abaa94dcs248be49b0db"
}
}
成功返回示例
状态码:200
Content-Type: application/json
{
"success": true,
"timestamp": 1540869200562,
"result": {}
}
失败返回示例
见 接口失败返回
手动触发场景
接口地址
POST /api/v1.0/invoke/open-ability/method/hotel-commands
请求参数
| 参数名 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| Content-Type | String | Header | 是 | 内容类型,值为application/json |
| Accept | String | Header | 是 | 接受类型,值为application/json |
| Authorization | String | Header | 是 | Bearer认证,访问令牌 |
| command | String | Body | 是 | 命令名称 |
| id | String | Body | 是 | 命令ID |
| param | Object<param> | Body | 是 | 命令参数 |
param说明
| 参数名 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| scene_id | String | Body | 是 | 场景ID |
| residences | []Object<residence> | Body | 是 | 住宅信息 |
residence说明
| 参数名 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| residence_id | String | Body | 是 | 住宅ID |
返回参数
| 参数名 | 类型 | 位置 | 说明 |
|---|---|---|---|
| Content-Type | String | Header | 内容类型,值为application/json |
| success | Boolean | Body | 判断请求是否成功 true:成功 false:失败 |
| timestamp | Integer | Body | 时间戳 |
| result | Object | Body | 返回结果 |
请求示例
POST /api/v1.0/invoke/open-ability/method/hotel-commands
Content-Type: application/json
Accept: application/json
Authorization: Bearer ac45e846ca23ab42c9ae469d988ae32a9
{
"command": "manual_trigger_scene",
"id": "c45e846ca23ab42c9ae469d988ae32a96",
"param": {
"scene_id": "s3b5a73f8dd84abaa94dcs248be49b0db",
"residences": [
{
"residence_id": "r31adc223cc4b3bedb6bd4742dedcfa52"
}
]
}
}
成功返回示例
状态码:200
Content-Type: application/json
{
"success": true,
"timestamp": 1540869200562,
"result": {}
}
失败返回示例
见 接口失败返回
启用自动化场景
接口地址
POST /api/v1.0/invoke/open-ability/method/hotel-commands
请求参数
| 参数名 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| Content-Type | String | Header | 是 | 内容类型,值为application/json |
| Accept | String | Header | 是 | 接受类型,值为application/json |
| Authorization | String | Header | 是 | Bearer认证,访问令牌 |
| command | String | Body | 是 | 命令名称 |
| id | String | Body | 是 | 命令ID |
| param | Object<param> | Body | 是 | 命令参数 |
param说明
| 参数名 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| scene_id | String | Body | 是 | 场景ID |
| enable_auto | Boolean | Body | 是 | 判断是否启用自动化 true:启用 false:禁用 |
返回参数
| 参数名 | 类型 | 位置 | 说明 |
|---|---|---|---|
| Content-Type | String | Header | 内容类型,值为application/json |
| success | Boolean | Body | 判断请求是否成功 true:成功 false:失败 |
| timestamp | Integer | Body | 时间戳 |
| result | Object | Body | 返回结果 |
请求示例
POST /api/v1.0/invoke/open-ability/method/hotel-commands
Content-Type: application/json
Accept: application/json
Authorization: Bearer ac45e846ca23ab42c9ae469d988ae32a9
{
"command": "enable_auto_scene",
"id": "c45e846ca23ab42c9ae469d988ae32a96",
"param": {
"scene_id": "s3b5a73f8dd84abaa94dcs248be49b0db",
"enable_auto": true
}
}
成功返回示例
状态码:200
Content-Type: application/json
{
"success": true,
"timestamp": 1540869200562,
"result": {}
}
失败返回示例
见 接口失败返回
获取场景历史记录
接口地址
POST /api/v1.0/invoke/open-ability/method/hotel-commands
请求参数
| 参数名 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| Content-Type | String | Header | 是 | 内容类型,值为application/json |
| Accept | String | Header | 是 | 接受类型,值为application/json |
| Authorization | String | Header | 是 | Bearer认证,访问令牌 |
| command | String | Body | 是 | 命令名称 |
| id | String | Body | 是 | 命令ID |
| param | Object<param> | Body | 是 | 命令参数 |
param说明
| 参数名 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| page_size | Integer | Body | 是 | 每页数量 |
| page_index | Integer | Body | 是 | 当前页数 |
返回参数
| 参数名 | 类型 | 位置 | 说明 |
|---|---|---|---|
| Content-Type | String | Header | 内容类型,值为application/json |
| success | Boolean | Body | 判断请求是否成功 true:成功 false:失败 |
| timestamp | Integer | Body | 时间戳 |
| result | []Object<result> | Body | 返回结果 |
result说明
| 参数名 | 类型 | 位置 | 说明 |
|---|---|---|---|
| scene_record_id | String | Body | 场景记录ID |
| scene_id | String | Body | 场景ID |
| scene_name | String | Body | 场景名称 |
| trigger_scene | Boolean | Body | 判断场景执行是否成功 true:成功 false:失败 |
| residence_id | String | Body | 住宅ID |
| detail | Object<detail> | Body | 详细信息 |
detail说明
| 参数名 | 类型 | 位置 | 说明 |
|---|---|---|---|
| trigger_config | String | Body | 触发器配置,见 场景触发器配置 |
| trigger_type | String | Body | 触发器类型,见 场景触发器配置 |
| room_tag_id | String | Body | 房间标签ID |
| manual | Boolean | Body | 判断是否是手动触发 true:是 false:否 |
| manual_by | String | Body | 手动执行人 |
请求示例
POST /api/v1.0/invoke/open-ability/method/hotel-commands
Content-Type: application/json
Accept: application/json
Authorization: Bearer ac45e846ca23ab42c9ae469d988ae32a9
{
"command": "get_scene_history",
"id": "c45e846ca23ab42c9ae469d988ae32a96",
"param": {
"page_size": 1,
"page_index": 1
}
}
成功返回示例
状态码:200
Content-Type: application/json
{
"success": true,
"timestamp": 1540869200562,
"result": [
{
"scene_record_id": "r8b5a73f8dd84abaa94dcs248be49b0d1",
"scene_id": "s8b5a73f8dd84abaa94dcs248be49b0db",
"scene_name": "my scene",
"trigger_scene": true,
"residence_id": "r31adc223cc4b3bedb6bd4742dedcfa52",
"detail": {
"trigger_config": "hotel",
"trigger_type": "check_in",
"room_tag_id": "",
"manual": false,
"manual_by": ""
}
}
]
}
失败返回示例
见 接口失败返回