---
name: "setAlarmSwitch"
mode: "api"
versionRequirements:
  - { name: "@ray-js/ray", version: "1.5.2" }
title: "setAlarmSwitch - Enable or Disable Device Alarm"
---

## setAlarmSwitch

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

### Description

Enable or disable the device’s alarm switch

### Parameters

`Params`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `params` | `ISetAlarmSwitch` | Yes | Request parameters |

### Return Value

Type: `Promise<boolean>`

Whether the setting succeeded

### Referenced Types

##### `interface` ISetAlarmSwitch

| Property | Type | Description |
| --- | --- | --- |
| `devId` | `string` | Device ID |
| `ruleIds` | `string` | Alarm rule IDs to enable or disable, separated by commas |
| `disabled` | `string` | Whether to disable alarms: 'true' disables, 'false' enables |


### Examples

#### Basic usage

```ts
import { setAlarmSwitch } from '@ray-js/ray';

setAlarmSwitch({
  devId: 'vdevo169477319679442',
  ruleIds: '123456,789012',
  disabled: 'false',
}).then((res) => {
  console.log('Setting result:', res);
}).catch((error) => {
  console.error(error);
});
```
