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

## getBindRuleList

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

### 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

##### IBindRuleListItem

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

### Referenced Types

##### `interface` IGetBindRuleList

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

##### `type` AssociativeEntityId

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

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

##### `interface` IBindRuleSceneItem

| Property | Type | Description |
| --- | --- | --- |
| `triggerRuleEnable` | `boolean` | Whether the wireless switch rule is enabled |
| `triggerRuleId` | `string` | Wireless switch execution rule ID |
| `actions` | `ISceneAction[]` | Action to execute |
| `alarmIssue` | `boolean` | Whether it is an alarm issue |
| `attribute` | `number` | Attribute Use powers of two of enum values for bitwise operations |
| `auditStatus` | `number` | Audit 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 linkage stores the gateway id, gwId |
| `containDeviceDelete` | `boolean` | Whether to include deleted devices |
| `coverIcon` | `string` | Icon |
| `description` | `string` | Rule description |
| `disableTime` | `number` | Disable timestamp |
| `displayColor` | `string` | Background color |
| `enabled` | `boolean` | Whether the rule is enabled |
| `forceCloudTrigger` | `boolean` | Whether to force cloud trigger |
| `id` | `string` | Execution rule ID |
| `iotAutoAlarm` | `boolean` | Whether it is an IoT automatic alarm |
| `isAlarmIssue` | `boolean` | Whether it is an alarm issue |
| `isLogicRule` | `boolean` | Whether it is a logic rule |
| `linkageType` | `number` | Linkage type |
| `localLinkage` | `boolean` | Whether it is local linkage |
| `logicRule` | `boolean` | Whether it is a logic rule |
| `matchType` | `number` | Match type 1. Any condition: triggers if any one of multiple conditions is met (OR). 2. All conditions: triggers only when all conditions are met. 3. Expression match: determined by the expr in the rule field; triggers when the condition is satisfied. |
| `name` | `string` | Linkage name or remarks |
| `needCleanGidSid` | `boolean` | Whether to clean up gidSid |
| `needValidOutOfWork` | `boolean` | Whether to check outside working hours |
| `newLocalScene` | `boolean` | Whether it is a new local scene |
| `offGwSync` | `boolean` | Whether to perform off-gateway synchronization |
| `offGwSyncSuccess` | `boolean` | Whether off-gateway synchronization succeeded |
| `orderWeight` | `number` | Sorting 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. Vendor-defined 3. User-defined 4. Security rule 5. Service-defined (e.g., DP point forwarding) |
| `runtimeEnv` | `string` | Runtime environment |
| `scenarioRule` | `boolean` | Whether it is a scene rule |
| `status` | `boolean` | Rule status |
| `statusConditions` | `any[]` | List of state conditions |
| `stickyOnTop` | `boolean` | Whether to show at the top of the home page |
| `subMatchType` | `number` | Sub-match type |
| `uid` | `string` | User 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 |


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