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

## bindDevice

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

### 描述

绑定或解绑设备

### 参数

`Params`

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

### 引用对象

##### `type` QueryBindDeviceDto

| 属性 | 类型 | 描述 |
| --- | --- | --- |
| `homeId` | `string` | 家庭 id |
| `stockId` | `string` | 库存 id |
| `bindUuidList` | `string[]` | 待绑定设备 uuid 列表（可选） |
| `unBindUuidList` | `string[]` | 待解绑设备 uuid 列表（可选） |


### 示例代码

#### 请求示例

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

bindDevice({
  homeId: '194137',
  stockId: 'stock-1',
  bindUuidList: ['vdevo1'],
})
  .then((ok) => console.log(ok))
  .catch(console.error);
```

#### 返回示例

```json
true
```
