Automatic Activation

Last Updated on : 2023-12-19 08:36:57

Automatic activation allows a device to be activated after being connected to the internet, without depending on a third-party device such as a mobile phone. Automatic activation eliminates the need for users to download an app and scan a QR code to pair a device. Some products come with complete features but also need a cloud connection to achieve more features (such as OTA updates, weather services, and cloud recipes) with a plug-and-play user experience. Automatic activation can meet this need.

Feature description

The process of automatic activation:

  1. The device connects to the cloud over MQTT.
  2. The cloud automatically creates a token.
  3. The cloud sends the token to the device.
  4. The device disconnects from the MQTT server.
  5. The device uses the token to request information such as the domain name and time zone to perform activation.

How it works

DeviceCloudInitiate connection over MQTT.Determine if the device candirectly connect to the cloud.Establish a connection if thedevice can be directlyconnected.Determine if the device supports automatic activation.Generate a token if automaticactivation is supported.Send the token.Disconnect the MQTTconnection.Get the configurationinformation with the token.Return information includingdomain name and time zone.Connect to the cloud foractivation.DeviceCloud

Development guide

Runtime environment

Open tuya_iot_config.h and check if the following macro is defined.

#define ENABLE_QRCODE_ACTIVE 1

How to

  • Create a product on the Tuya IoT Development Platform and then enter the product development process. Click on the Function Definition tab, scroll down to Advanced Functions, and enable LinkSDK and Device Automatic Activation. Purchase licenses for device authorization using the PID of this product.

    Automatic Activation

    You might not find LinkSDK and Device Automatic Activation in Advanced Functions. This is because the product solution does not have these two functions bound. To request binding them with your product, contact your account manager or submit a service ticket.

    You can use the purchased license to implement the automatic activation function only after enabling LinkSDK and Device Automatic Activation.

  • After the call of device initialization, set the network information (for Wi-Fi devices, set the Wi-Fi’s SSID and password with an API request). After the device is connected to the internet, it will initiate an MQTT connection and proceed with activation.