---
name: "removeRule"
mode: "api"
versionRequirements:
  - { name: "@ray-js/ray", version: "1.7.60" }
title: "removeRule - 移除场景规则"
---

## removeRule

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

### Description

Remove scene rules under the related button conditions

### Parameters

`Params`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `params` | `IRemoveRule` | Yes | Parameters for removing rules |

### Return Value

Type: `Promise<boolean>`

Whether deletion succeeded

### Referenced Types

##### `interface` IRemoveRule

| Property | Type | Description |
| --- | --- | --- |
| `bizDomain` | `string` | Business domain |
| `sourceEntityId` | `string` | Identifier for establishing a binding relationship with the panel/device |
| `devId` | `string` | Device ID |
| `associativeEntityId` | `AssociativeEntityId` | Binding relationship identifier |
| `associativeEntityValue` | `AssociativeEntityValue` | Rule ID |
| `gid` | `string` | Home ID |

##### `type` AssociativeEntityId

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

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

##### `type` AssociativeEntityValue

Use when associativeEntityId is insufficient to distinguish; typically can associate devices, DP values, groups, rules, etc.

```typescript
type AssociativeEntityValue = string;
```


### Examples

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

const removeSceneRule = async () => {
  try {
    const success = await removeRule({
      bizDomain: 'wirelessSwitch',
      devId: 'device_001',
      associativeEntityId: '1',
      associativeEntityValue: 'rule_001',
      gid: '12345678',
    });
    console.log('Removal result:', success);
  } catch (err) {
    console.error('Removal failed:', err);
  }
};
```
