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

## updateDeviceConfig

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

### Description

Modify device service configuration items

### Parameters

`Params`

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

### Referenced Types

##### `type` UpdateDeviceConfigParams

| Property | Type | Description |
| --- | --- | --- |
| `devId` | `string` | Device ID |
| `configId` | `number` | Config item ID (optional) |
| `configCode` | `string` | Configuration code |
| `configValue` | `string` | Config value (optional) |
| `configType` | `"VisionEventType.PRESET" \\| "VisionEventType.CUSTOM"` | Configuration type |
| `enableState` | `"DeviceServiceConfigState.Delete" \\| "DeviceServiceConfigState.Available" \\| "DeviceServiceConfigState.Unavailable"` | Enable status (corresponds to configState) |
| `serviceBusinessType` | `"aiSmartFreeEvent" \| "aiSmartFreeEventImage2Text"` | Smart event business type |

##### `enum` VisionEventType

| Enum Value | Actual Value | Description |
| --- | --- | --- |
| `VisionEventType.PRESET` | `0` | Preset event |
| `VisionEventType.CUSTOM` | `1` | Custom event |

##### `enum` DeviceServiceConfigState

| Enum Value | Actual Value | Description |
| --- | --- | --- |
| `DeviceServiceConfigState.Delete` | `0` | Deleted |
| `DeviceServiceConfigState.Available` | `1` | Available |
| `DeviceServiceConfigState.Unavailable` | `2` | Unavailable |

##### `interface` DeviceServiceConfigItemDto

| Property | Type | Description |
| --- | --- | --- |
| `configId` | `number` | Configuration item ID |
| `configCode` | `string` | Configuration code |
| `configType` | `"VisionEventType.PRESET" \\| "VisionEventType.CUSTOM"` | Configuration type (preset / custom) |
| `configValue` | `string` | Configuration value |
| `configCodeIcon` | `string` | Configuration icon (optional) |
| `configState` | `"DeviceServiceConfigState.Delete" \\| "DeviceServiceConfigState.Available" \\| "DeviceServiceConfigState.Unavailable"` | Configuration status |


### Examples

#### Request example

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

updateDeviceConfig({
  devId: 'vdevo1',
  serviceBusinessType: 'aiSmartFreeEvent',
  configCode: 'person',
  configType: 0,
  enableState: 1,
})
  .then((id) => console.log(id))
  .catch(console.error);
```

#### Response example

```json
1
```
