---
name: "getSceneList"
mode: "api"
versionRequirements:
  - { name: "@ray-js/ray", version: "1.4.61" }
title: "getSceneList - 查询设备支持的一键执行场景"
---

## getSceneList

> [VERSION] @ray-js/ray >= 1.4.61

### 描述

查询设备支持的一键执行场景，包含失效及自动化规则

### 参数

`Params`

| 参数 | 类型 | 必填 | 描述 |
| --- | --- | --- | --- |
| `params` | `ISceneListParams` | 是 | 查询参数 |

### 返回值

类型: `Promise<ISceneListItem[]>`

联动规则列表

##### ISceneListItem

| 属性 | 类型 | 描述 |
| --- | --- | --- |
| `actions` | `any[]` | 执行动作 |
| `attribute` | `number` | 属性 |
| `auditStatus` | `number` | 审核状态 |
| `background` | `string` | 背景图地址 |
| `boundForPanel` | `boolean` | 面板绑定 |
| `boundForWiFiPanel` | `boolean` | WiFi 面板绑定 |
| `code` | `string` | 规则 code |
| `commonField` | `string` | 通用字段 |
| `coverIcon` | `string` | 图标 |
| `disableTime` | `number` | 禁用时间 |
| `displayColor` | `string` | 背景颜色 |
| `enabled` | `true` | 规则是否启用 |
| `devId` | `string` | 设备 ID |
| `name` | `string` | 联动名称 |
| `id` | `string` | 执行规则 ID |

### 引用对象

##### `interface` ISceneListParams

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


### 示例代码

```typescript
import { getSceneList } from '@ray-js/ray';

const fetchScenes = async () => {
  try {
    const scenes = await getSceneList({
      devId: 'device_001',
      gid: '12345678',
    });
    console.log('场景列表:', scenes);
  } catch (err) {
    console.error('查询失败:', err);
  }
};
```
