---
name: "getSceneListByHomeID"
mode: "kit"
versionRequirements:
  - { name: "@tuya-miniapp/cloud-api", version: "1.1.0" }
---

## getSceneListByHomeID

> [VERSION] @tuya-miniapp/cloud-api >= 1.1.0

> 💡 接口依赖云能力，需在 [小程序开发者平台](https://platform.tuya.com/miniapp/)开发设置-云能力 进行授权配置。
> 注意：返回示例仅供参考，其包含字段大于返回参数定义范围，请勿使用除本文返回参数定义以外的返回数据，否则可能会导致程序异常。

### 描述

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

### 参数

`Params`

| 参数 | 类型 | 必填 | 默认值 | 描述 |
| --- | --- | --- | --- | --- |
| `params` | `GetSceneListByHomeIDParams` | 是 | - | 请求体 |

### 引用对象

##### `interface` GetSceneListByHomeIDParams

| 属性 | 类型 | 描述 |
| --- | --- | --- |
| `gid` | `string` | 家庭ID |

##### `interface` Action

| 属性 | 类型 | 描述 |
| --- | --- | --- |
| `actionExecutor` | `string` | 执行动作的执行者 |
| `actionStrategy` | `string` | 执行动作的策略 |
| `attribute` | `number` | 属性值 |
| `defaultIconUrl` | `string` | 默认图标 URL |
| `devDelMark` | `boolean` | 如果当前是设备类型条件，该字段表达关联设备是否被移除 |
| `enabled` | `boolean` | 动作是否启用 |
| `entityId` | `string` | 实体ID，表示动作所属的实体的ID |
| `executorProperty` | `Record<string, string \| number \| false \| true>` | 动作执行信息 |
| `executorPropertyKeyOrder` | `string[]` | `executorProperty` 内键的展示/下发顺序 |
| `extraProperty` | `Record<string, unknown>` | 额外信息 |
| `gmtModified` | `number` | 修改时间戳 |
| `id` | `string` | 动作的唯一ID |
| `offGwSync` | `boolean` | 网关同步标记，表示是否网关同步 |
| `orderNum` | `number` | 动作的顺序号 |
| `ruleId` | `string` | 规则ID，表示动作所属的规则的ID |
| `status` | `boolean` | 动作状态 |
| `uid` | `string` | 用户ID，表示动作所属的用户的ID |

##### `interface` Condition

| 属性 | 类型 | 描述 |
| --- | --- | --- |
| `attribute` | `number` | 属性值 |
| `condType` | `number` | 条件类型 |
| `defaultIconUrl` | `string` | 默认图标 URL |
| `devDelMark` | `boolean` | 如果当前是设备类型条件，该字段表达关联设备是否被移除 |
| `enabled` | `boolean` | 条件是否启用 |
| `entityId` | `string` | 实体ID，表示条件所属的实体的ID |
| `entitySubIds` | `string` | 条件关联的子实体 ID 列表（如多 DP 组合） |
| `entityType` | `number` | 条件类型 |
| `expr` | `string \| number[][]` | 条件表达式 |
| `extraInfo` | `Record<string, unknown>` | 额外信息 |
| `handleStrategy` | `string` | 条件命中后的处理策略标识 |
| `iconUrl` | `string` | 图标URL |
| `id` | `string` | 条件ID，表示条件所属的条件的ID |
| `orderNum` | `number` | 条件在规则内的排序号 |
| `ruleId` | `string` | 联动ID，表示条件所属的联动的ID |
| `serviceProvider` | `string` | 服务提供商标识 |
| `support` | `number` | 能力/服务支持位标记（与云端约定） |


### 示例代码

#### 请求示例

```typescript
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);
  });
```

#### 返回示例

```json
[
  {
    "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"
  }
]
```
