---
name: "SmartTapToRunAbility.getBindTapToRunRules"
mode: "api"
versionRequirements:
  - { name: "@ray-js/panel-sdk", version: "1.11.0" }
title: "getBindTapToRunRules - 查询当前已经绑定的一键执行列表。"
summary: "查询当前设备已经绑定的一键执行规则列表。"
---

## SmartTapToRunAbility.getBindTapToRunRules

> [VERSION] @ray-js/panel-sdk >= 1.11.0

> 💡 仅支持单设备，不支持群组环境。
> 注意，返回示例仅供参考，其包含字段大于返回参数定义范围，请勿使用除本文返回参数定义以外的返回数据，否则可能会导致程序异常。

### 描述

查询已绑定一键执行的联动列表

### 参数

`Params`

| 参数 | 类型 | 必填 | 描述 |
| --- | --- | --- | --- |
| `params` | `TapToRunQueryParams` | 否 | 查询参数 |

### 返回值

类型: `Promise<BindTapToRunRules>`

已绑定的一键执行规则列表

### 引用对象

##### `type` TapToRunQueryParams

一键执行查询参数

| 属性 | 类型 | 描述 |
| --- | --- | --- |
| `devId` | `string` | 设备 ID，不传则使用当前设备 |
| `gid` | `string` | 家庭 ID，不传则使用当前 App 家庭 |
| `containStandardZigBee` | `boolean` | 是否包含标准 Zigbee 场景 |

##### `type` BindTapToRunRules

已绑定的一键执行联动规则列表

```typescript
export type BindTapToRunRules = BindTapToRunRule[];
```

##### `type` BindTapToRunRule

已绑定的一键执行项

| 属性 | 类型 | 描述 |
| --- | --- | --- |
| `associativeEntityId` | `string` | 关联实体 ID，格式为 dpId#dpValue |
| `associativeEntityValueList` | `BindTapToRunLinkedRule[]` | 关联实体的值列表 |
| `bindId` | `number` | 绑定 ID |
| `bizDomain` | `string` | 业务域，一键执行固定为 wirelessSwitchBindScene |
| `enable` | `boolean` | 是否启用 |
| `sourceEntityId` | `string` | 源设备 ID |

##### `type` BindTapToRunLinkedRule

已绑定的一键执行目标规则

| 属性 | 类型 | 描述 |
| --- | --- | --- |
| `ruleType` | `number` | 规则类型 |
| `triggerRuleEnable` | `boolean` | 规则是否启用 |
| `triggerRuleId` | `string` | 执行规则 ID，一般用来进行触发 |

##### `type` TapToRunRule

可绑定的一键执行规则

| 属性 | 类型 | 描述 |
| --- | --- | --- |
| `actions` | `TapToRunAction[]` | 执行动作列表 |
| `background` | `string` | 背景图地址 |
| `boundForPanel` | `boolean` | 面板绑定 |
| `boundForWiFiPanel` | `boolean` | WiFi 面板绑定 |
| `coverIcon` | `string` | 图标 |
| `displayColor` | `string` | 背景颜色 |
| `enabled` | `boolean` | 规则是否启用 |
| `id` | `string` | 执行规则 ID |
| `name` | `string` | 联动名称或备注 |

##### `type` TapToRunAction

一键执行动作项

| 属性 | 类型 | 描述 |
| --- | --- | --- |
| `actionDisplay` | `string` | 执行动作的显示名称 |
| `actionExecutor` | `string` | 执行动作的执行者 |
| `actionStrategy` | `string` | 执行动作的执行策略 |
| `entityId` | `string` | 动作所属实体 ID |
| `gmtModified` | `number` | 修改时间戳 |
| `id` | `string` | 动作唯一 ID |
| `orderNum` | `number` | 动作顺序号 |
| `ruleId` | `string` | 规则 ID |
| `status` | `boolean` | 动作状态 |


### 示例代码

#### 示例

```typescript
const bindRules = await sdm.tapToRun.getBindTapToRunRules();
bindRules.forEach(item => {
  console.log('绑定 ID:', item.bindId);
  item.associativeEntityValueList.forEach(rule => {
    console.log('已绑定规则:', rule.id, rule.name);
  });
});
```
