Last Updated on : 2024-06-14 18:20:57download
You can integrate a general device panel into your WeChat mini program as a plug-in without additional development. You only need to pass in parameters to implement device control and management. Device management supports a bunch of features. For example, users can edit a device name, check a virtual device ID, update device firmware, and remove devices. Firmware update is available to Wi-Fi devices only, and Bluetooth devices are not supported.
Features: control and manage devices
Details of device management: edit a device name, check a virtual device ID, update device firmware, and remove a device
Follow the instructions in Plug-In to create an IoT WeChat mini program and request permissions to use the General Device Panel plug-in.
Add plug-in settings to app.json of your project.
plugins: {
'tuya-panel-plugin': {
version: '1.1.1', // This is an example. Use the latest version in the actual project.
provider: 'wx3f05102b6bf4d5d4',
},
},
Add the JavaScript code block for navigation to the plug-in:
wx.navigateTo({
url: `plugin://tuya-panel-plugin/panel?ticket=${ticket}&clientId=${clientId}&device_id=${device_id}`,
});
The navigation path includes the following parameters:
| Parameter name | Type | Required | Description |
|---|---|---|---|
| clientId | string | Yes | The third-party unique identifier. It matches the value of AccessID for the WeChat Mini Program SDK on the Tuya Developer Platform. |
| ticket | string | Yes | The pairing token. For more information about how to get the token, see User Management. |
| device_id | string | Yes | Get a list of devices under a specified user. |
| uiMode | string | No | The theme color. Default value: #27c3d9. The default value is applied to the background color and button color of the device control page. |
| is_manager | string | No | The administrator who is authorized to rename, update, and remove a device. Valid values: true or false. Default value: true. |
| gid | string | No | The home ID. A device must be bound with a home. For more information about how to get the home ID, see Home Management (currently in Chinese only). |
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback