Last Updated on : 2024-06-19 09:22:21download
This topic describes how to connect gateways and gateway sub-devices to the Tuya Developer Platform through TuyaLink.
Log in to the Tuya Developer Platform. Click Create.
On the Standard Category tab, Choose Gateway Control > Gateway. Choose TuyaLink for smart mode.
Choose Gateway Device for device type. If you choose other options, sub-device management cannot be implemented. For more information, see Product Creation.
Add standard functions or create custom functions as needed. For more information, see Function Definition.
Log in to the Tuya Developer Platform. Click Create.
On the Standard Category tab, Choose Gateway Control > Gateway. Choose TuyaLink for smart mode. Choose Gateway Sub-Device for device type.
Add standard functions or create custom functions as needed. For more information, see Function Definition.
You can integrate with the gateway application either through the Tuya MQTT Standard Protocol or the Tuya IoT Core SDK. Before activation, purchase licenses or request free licenses and assign the license to your gateway product. Get the device certificate (including PruductID
, DeviceID
, and DeviceSecret
) after device registration and flash the certificate to your gateway device. Then, the gateway can connect to the internet and come online.
For more information, see Device Management.
This step will connect a sub-device to a gateway device that has been connected to the Tuya Developer Platform. Before activation, purchase licenses or request free licenses and assign the license to your sub-device product. For more information, see License Management.
You have two options for registering and managing sub-devices, namely dynamic registration and manual registration.
Option 1: Dynamic registration
The gateway acts as a proxy to activate and bind sub-devices and manage topology. This frees you from flashing certificates to sub-devices and manual device registration.
When the gateway activates sub-devices, it publishes messages to the topic Gateway Dynamically Registers Sub-devices to pass parameters to sub-devices for activation and registration. One license is consumed for each registered sub-device. Meanwhile, the topological relationship between the sub-device and the gateway is automatically established. By default, the registered sub-device will be bound to the asset or home that the gateway has been bound to. For more information, see Step 5: Usage scenarios.
Parameters | Description |
---|---|
clientid | Required field. The registration ID, which is unique under one product. It is used for the topological management of devices. You can view the client ID in Device Management > Registration ID. |
Option 2: Manual registration
In the Device Management step for the sub-device product, register devices to get sub-device certificates (including ProductID
, DeviceID
, and DeviceSecret
). One license is consumed for each registered sub-device. The gateway imports the deviceid
of sub-devices. When sub-devices are connected to the gateway, the gateway calls the sub-device topology to subscribe to the topic so that it can bind to sub-devices. By default, the registered sub-device will be bound to the asset or home that the gateway has been bound to.
After sub-device registration and topology creation are completed, you can view the sub-device list in the Device Management of the gateway product.
To remove a registered sub-device, reset this device or delete it in Device Management. Before deletion, make sure you have unbound the sub-device from the gateway. After deletion, the license that was consumed for this sub-device will be released and available for use.
To proceed with this step, you must have activated your gateway device and obtained the QR code and bind code from Device Details > QR Code Binding.
In this step, two usage scenarios are provided to illustrate how you can use the connected gateway and sub-devices for IoT projects.
Bind gateway devices to a cloud development project for SaaS application and system integration.
The gateway acts as a proxy to activate and register sub-devices. The registered sub-devices are automatically bound to the asset associated with the gateway. You can view these sub-devices on the Smart Industry app or in the Asset of your cloud development project.
For more information about application development and device binding, see Application Development.
Bind the gateway to a home by using the Smart Life app. All the sub-devices connected to the gateway are automatically bound to this home.
Then, the gateway and sub-devices can be controlled by using the app.
See Best Practices.
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback