場景管理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": ""
}
}
]
}
失敗返回示例
見 接口失敗返回