---
name: "updateSmartEventSwitchState"
mode: "kit"
versionRequirements:
  - { name: "@tuya-miniapp/cloud-api", version: "1.0.5" }
---

## updateSmartEventSwitchState

> [VERSION] @tuya-miniapp/cloud-api >= 1.0.5

### 描述

更新智能事件开关

### 参数

`Params`

| 参数 | 类型 | 必填 | 默认值 | 描述 |
| --- | --- | --- | --- | --- |
| `params` | `UpdateSwitchStateParams` | 是 | - | 请求体 |

### 引用对象

##### `type` UpdateSwitchStateParams

| 属性 | 类型 | 描述 |
| --- | --- | --- |
| `devId` | `string` | 设备 id |
| `switchState` | `0 \| 1` | 开关状态（0 / 1） |
| `serviceBusinessType` | `"aiSmartFreeEvent" \| "aiSmartFreeEventImage2Text"` | 智能事件业务类型 |
| `extContent` | `string` | 扩展内容（JSON 字符串） |


### 示例代码

#### 请求示例

```typescript
import { updateSmartEventSwitchState } from '@tuya-miniapp/cloud-api';

updateSmartEventSwitchState({
  devId: 'vdevo1',
  serviceBusinessType: 'aiSmartFreeEvent',
  switchState: 1,
  extContent: '{}',
})
  .then((ok) => console.log(ok))
  .catch(console.error);
```

#### 返回示例

```json
true
```
