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

## updateSmartEventSwitchState

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

### Description

Update smart event switch

### Parameters

`Params`

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `params` | `UpdateSwitchStateParams` | Yes | - | Request body |

### Referenced Types

##### `type` UpdateSwitchStateParams

| Property | Type | Description |
| --- | --- | --- |
| `devId` | `string` | Device ID |
| `switchState` | `0 \| 1` | Switch state (0 / 1) |
| `serviceBusinessType` | `"aiSmartFreeEvent" \| "aiSmartFreeEventImage2Text"` | Smart event business type |
| `extContent` | `string` | Extended content (JSON string) |


### Examples

#### Request example

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

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

#### Response example

```json
true
```
