---
name: "getBindRuleList"
mode: "api"
versionRequirements:
  - { name: "@ray-js/ray", version: "1.4.61" }
title: "getBindRuleList"
---

## getBindRuleList

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

### Method signature

```typescript
getBindRuleList(params: IGetBindRuleList)
```

### Description

Query scenes bound to the device condition

### Parameters

`Params`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `params` | `IGetBindRuleList` | Yes | Query parameters |

### Return Value

Type: `Promise<IBindRuleListItem[]>`

List of bound rules

### Referenced Types

##### `interface` IGetBindRuleList

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `bizDomain` | `string` | Yes | Business domain |
| `devId` | `string` | Yes | Device ID |
| `sourceEntityId` | `string` | No | Binding identifier with panel/device |
| `entityType` | `"EntityType.DEVICE" \\| "EntityType.RULE"` | Yes | Entity type: 1 for device, 2 for linkage rule |
| `gid` | `string` | Yes | Home ID |

##### `interface` IBindRuleListItem

| Property | Type | Description |
| --- | --- | --- |
| `associativeEntityId` | `AssociativeEntityId` | Establish a binding with a panel/device, typically using a device ID, DP, group, rule, or dpId#value |
| `associativeEntityValueList` | `IBindRuleSceneItem[]` | List of associated entity values |
| `bindId` | `number` | Binding ID, typically used for unbinding |
| `bizDomain` | `string` | Business domain |
| `enable` | `boolean` | Whether enabled |
| `sourceEntityId` | `string` | Device ID |

##### `enum` EntityType

| Enum Value | Actual Value | Description |
| --- | --- | --- |
| `EntityType.DEVICE` | `1` | Associated entity is a device |
| `EntityType.RULE` | `2` | Associated entity is a linkage rule |

##### `type` AssociativeEntityId

Binding with panel/device, typically device ID, DP point, group, rule, dpId#value, etc.

```typescript
type AssociativeEntityId = string;
```

##### `type` IBindRuleSceneItem

| Property | Type | Description |
| --- | --- | --- |
| `triggerRuleEnable` | `boolean` | Whether the wireless switch rule is enabled |
| `triggerRuleId` | `string` | Wireless switch execution rule ID |
| `actions` | `ISceneAction[]` | Execution action |
| `alarmIssue` | `boolean` | Whether this is an alarm issue |
| `attribute` | `number` | Attributes Perform bitwise operations using powers of 2 corresponding to the enum values |
| `auditStatus` | `number` | Review status 0. Not reviewed 1. Approved 2. Rejected |
| `background` | `string` | Background image URL |
| `boundForPanel` | `boolean` | Panel binding |
| `boundForWiFiPanel` | `boolean` | WiFi panel binding |
| `code` | `string` | Rule code |
| `commonField` | `string` | Generic JSON field; for example, local automation stores the gateway ID as gwId |
| `containDeviceDelete` | `boolean` | Whether to include deleted devices |
| `coverIcon` | `string` | Icon |
| `description` | `string` | Rule description |
| `disableTime` | `number` | Deactivation timestamp |
| `displayColor` | `string` | Background color |
| `enabled` | `boolean` | Whether the rule is enabled |
| `forceCloudTrigger` | `boolean` | Whether to force cloud triggering |
| `id` | `string` | Execution rule ID |
| `iotAutoAlarm` | `boolean` | Whether this is an IoT automatic alert |
| `isAlarmIssue` | `boolean` | Whether this is an alert issue |
| `isLogicRule` | `boolean` | Whether this is a logic rule |
| `linkageType` | `number` | Automation type |
| `localLinkage` | `boolean` | Whether this is a local automation |
| `logicRule` | `boolean` | Whether this is a logic rule |
| `matchType` | `number` | Match type 1. Any condition: triggers when any of the conditions is met (OR relationship). 2. All conditions: triggers only when all conditions are met. 3. Expression-based matching: uses expr in the rule field to determine whether the conditions are met and triggers when they are. |
| `name` | `string` | Automation name or remarks |
| `needCleanGidSid` | `boolean` | Whether gidSid needs to be cleared |
| `needValidOutOfWork` | `boolean` | Whether to check if the time is outside working hours |
| `newLocalScene` | `boolean` | Whether this is a new local scene |
| `offGwSync` | `boolean` | Whether to synchronize with an offline gateway |
| `offGwSyncSuccess` | `boolean` | Whether synchronization with the offline gateway succeeded |
| `orderWeight` | `number` | Sort weight |
| `outOfWork` | `number` | Outside-working-hours flag |
| `ownerId` | `string` | Home ID |
| `panelType` | `number` | Panel type |
| `permissionCode` | `string` | Permission code |
| `ruleGenre` | `number` | Rule category |
| `ruleSource` | `number` | Rule source |
| `ruleType` | `number` | Rule type 1. System-defined 2. Merchant-defined 3. User-defined 4. Security rule 5. Service-defined (such as DP forwarding) |
| `runtimeEnv` | `string` | Runtime environment |
| `scenarioRule` | `boolean` | Whether this is a scene rule |
| `status` | `boolean` | Rule status |
| `statusConditions` | `any[]` | State condition list |
| `stickyOnTop` | `boolean` | Whether to display at the top of the home page |
| `subMatchType` | `number` | Sub-match type |
| `uid` | `string` | User ID |


### Valid Values

##### `EntityType`

| Value | Description | Since |
| --- | --- | --- |
| `1` | Associated entity is a device | - |
| `2` | Associated entity is a linkage rule | - |


### Examples

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

const fetchBindRules = async () => {
  try {
    const rules = await getBindRuleList({
      bizDomain: 'wirelessSwitch',
      devId: 'device_001',
      entityType: 1,
      gid: '12345678',
    });
    rules.forEach(rule => {
      console.log(`Bind ID: ${rule.bindId}, Enabled: ${rule.enable}`);
    });
  } catch (err) {
    console.error('Query failed:', err);
  }
};
```
