getSceneListByHomeID(params: GetSceneListByHomeIDParams)

版本要求:
@tuya-miniapp/cloud-api≥1.1.0

描述

获取家庭下一键执行和自动化场景列表

参数

参数类型必填说明
是请求体

返回值

类型:Promise<GetSceneListByHomeIDResult>
GetSceneListByHomeIDResult(字段含义见类型定义与 minituya 返回参数)

引用对象

typeGetSceneListByHomeIDResult
Scene[]

示例代码

请求示例

import { getSceneListByHomeID } from '@tuya-miniapp/cloud-api';

getSceneListByHomeID({
  gid: '123456789',
})
  .then(response => {
    console.log(response);
  })
  .catch(error => {
    console.error('Failed to get scene list:', error);
  });

返回示例

[
  {
    "id": "scene_001",
    "name": "回家模式",
    "coverIcon": "https://example.com/icon.png",
    "description": "回家时自动开启灯光",
    "displayColor": "6559D1",
    "enabled": true,
    "matchType": 1,
    "ruleGenre": 2,
    "ruleType": 3,
    "runtimeEnv": "prod",
    "scenarioRule": true,
    "actions": [
      {
        "id": "action_001",
        "actionExecutor": "dpIssue",
        "actionStrategy": "edge",
        "attribute": 3,
        "defaultIconUrl": "https://example.com/icon.png",
        "deleteDevIcon": "https://example.com/icon.png",
        "devDelMark": true,
        "enabled": true,
        "entityId": "device_001",
        "executorProperty": {
          "28": 18
        },
        "executorPropertyKeyOrder": [
          "28"
        ],
        "extraProperty": {
          "dpScale": 0,
          "path": "/pages/device/detail/index"
        },
        "gmtModified": 1699200000000,
        "offGwSync": false,
        "orderNum": 1,
        "ruleId": "scene_001",
        "status": false,
        "uid": "user_001"
      }
    ],
    "conditions": [
      {
        "id": "condition_001",
        "attribute": 3,
        "condType": 1,
        "defaultIconUrl": "https://example.com/icon.png",
        "deleteDevIcon": "https://example.com/icon.png",
        "devDelMark": true,
        "enabled": true,
        "entityId": "device_002",
        "entitySubIds": "1",
        "entityType": 1,
        "expr": [
          [
            "$dp1",
            "==",
            "disarmed"
          ]
        ],
        "extraInfo": {},
        "handleStrategy": "",
        "iconUrl": "https://example.com/icon.png",
        "orderNum": 1,
        "ruleId": "scene_001",
        "serviceProvider": "",
        "support": 0
      }
    ],
    "arrowIconUrl": "https://example.com/arrow.png",
    "attribute": 4,
    "auditStatus": 0,
    "background": "",
    "boundForPanel": false,
    "boundForWiFiPanel": false,
    "categorys": [
      "home",
      "light"
    ],
    "code": "",
    "commonField": "{\"subMatchType\":1}",
    "containDeviceDelete": false,
    "deviceIds": [
      "device_001",
      "device_002"
    ],
    "disableTime": 0,
    "forceCloudTrigger": false,
    "gmtCreate": 1699200000000,
    "gmtModified": 1699200000000,
    "iotAutoAlarm": false,
    "isAlarmIssue": false,
    "isLogicRule": false,
    "linkageType": 0,
    "localLinkage": false,
    "needCleanGidSid": false,
    "needValidOutOfWork": false,
    "newLocalScene": false,
    "offGwSync": false,
    "offGwSyncSuccess": false,
    "orderWeight": 1,
    "outOfWork": 0,
    "ownerId": "123456789",
    "panelType": 0,
    "permissionCode": "",
    "ruleSource": 0,
    "status": true,
    "statusConditions": [],
    "stickyOnTop": true,
    "subMatchType": 1,
    "uid": "user_001"
  }
]