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

## updateDeviceConfig

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

### Method signature

```typescript
updateDeviceConfig(params: UpdateDeviceConfigParams)
```

### Description

Modify device service configuration items

### Parameters

`Params`

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

### Return Value

Type: `Promise<number>`

Updated configId

### Referenced Types

##### `type` UpdateDeviceConfigParams

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `devId` | `string` | Yes | Device ID |
| `configId` | `number` | No | Config item ID (optional) |
| `configCode` | `string` | Yes | Configuration code |
| `configValue` | `string` | No | Config value (optional) |
| `configType` | `"VisionEventType.PRESET" \\| "VisionEventType.CUSTOM"` | Yes | Configuration type |
| `enableState` | `"DeviceServiceConfigState.Delete" \\| "DeviceServiceConfigState.Available" \\| "DeviceServiceConfigState.Unavailable"` | Yes | Enable status (corresponds to configState) |
| `serviceBusinessType` | `"aiSmartFreeEvent" \| "aiSmartFreeEventImage2Text"` | Yes | 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 |


### Valid Values

##### `VisionEventType`

| Value | Description | Since |
| --- | --- | --- |
| `0` | Preset event | - |
| `1` | Custom event | - |

##### `DeviceServiceConfigState`

| Value | Description | Since |
| --- | --- | --- |
| `0` | Deleted | - |
| `1` | Available | - |
| `2` | Unavailable | - |

##### `UpdateDeviceConfigParams.serviceBusinessType`

| Value | Description | Since |
| --- | --- | --- |
| `aiSmartFreeEvent` | - | - |
| `aiSmartFreeEventImage2Text` | - | - |


### 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
```
