This topic uses the TG7100C chip as an example to describe how to test network provisioning and cloud connection on a development board for a private-brand smart socket. It also provides information about developing products for international markets and mass-producing device certificates.
Create and configure a product
Create a private-brand project. For more information, see Create a project.
Create a product in the socket category. For more information, see Create a product.
Define product features.
The smart_outlet sample code includes a complete, exported Thing Specification Language (TSL) model file at Products/example/smart_outlet/smart_outlet.json. After you create a product, you can import this TSL model into your new product.
You can import a TSL model into a new product in two ways: copy a TSL model from an existing product or import a JSON file.
Copy the ProductKey of the new product.
Edit the Products/example/smart_outlet/smart_outlet.json file. Replace the value of the productKey field with the new ProductKey and save the file.

Import a JSON file.
When you import the TSL model, select the JSON file from the Products/example/smart_outlet/smart_outlet.json path. For more information about how to import a TSL model, see Import a TSL model.
Note the following when you import a TSL model.
Select the smart_outlet.json file from the Products/example/smart_outlet path.

If your product is sold outside the Chinese mainland, make sure the JSON object definition for the local timer property includes TimezoneOffset. This parameter is required for the local timer feature to work correctly in different time zones.

Configure the human-computer interaction.
To use the public version of the Cloud Intelligence App, enable the corresponding switch.

Make sure to complete all required configuration items. For more information, see Configure human-computer interaction.

Generate a test device certificate.
The Bluetooth-assisted network provisioning solution requires that the Wi-Fi MAC address matches the DeviceName in the device certificate. On the TG7100C development board, after the firmware is running, you can enter the mac command through the serial port to query the chip's current Wi-Fi MAC address. Use this MAC address as the DeviceName to request a test device certificate on the device debugging page. Note that all letters in the MAC address must be in lowercase.
Example of querying a Wi-Fi MAC address:
#mac MAC address: 18-b9-05-c0-6e-d5Enter the MAC address in lowercase, such as 18b905c06ed5, as the DeviceName to generate a test device certificate.

Copy the test device certificate. Make sure to copy the ProductKey, DeviceName, DeviceSecret, ProductSecret, and ProductID completely and in order.

Mass produce and publish the device.
On the mass production page, confirm the Product Information. Read and select the Developer Notice and Authorization Agreement check boxes. Then, confirm the product release. After the product is released, the device can be discovered on the Auto Discovery page of the Cloud Intelligence App when it is in the network provisioning state.

Provision the device and connect it to the cloud
Set the device certificate.
After you program the device firmware to the development board, you can run the linkkey command to set the device certificate. Then, run the reset command to reset the device.
To set the device certificate, write the complete device certificate information to the development board after the device is powered on.
linkkey ProductKey DeviceName DeviceSecret ProductSecret ProductIDReset the device to purge the network provisioning information.
reset
Provision the network using the Cloud Intelligence App (V3.5.5 or later).
Set the device certificate for the private-brand product on the development board and reset the device. The device enters the network provisioning state and broadcasts its network provisioning information through Bluetooth Low Energy (BLE).
Products confirmed as 'Development Complete' on the Batch Production page can be discovered on the Auto Discover page of the Cloud Intelligence App while they await network configuration. If a product is not confirmed as 'Development Complete', you can click Add Manually to open the Add Manually page. Then, select the 'Bluetooth + Wi-Fi' connection method for the corresponding product category and start the network configuration.
The app network provisioning process is shown in the following figure.

Key log examples for device-side network provisioning and cloud connection
Bluetooth-assisted network provisioning
Network provisioning state
Command/Action
Expected log
Device reset
reset
start-----------hal
Enable Bluetooth-assisted network provisioning
ble_awss
ble_awss_open
Parse SSID/PWD
Device parses hot spot information
IOTX_AWSS_GOT_SSID_PASSWD
AP Connect
Device connects to AP
IOTX_AWSS_CONNECT_ROUTER
DHCP Get IP
Device gets IP address
IOTX_AWSS_GOT_IP
Cloud Connect
Cloud connection successful
Cloud Connected
Zero-touch provisioning
Network provisioning state
Command/Action
Expected log
Device reset
reset
start-----------hal
Dev Scan
awss
IOTX_AWSS_START
Awss Process
active_awss
IOTX_AWSS_ENABLE
Parse SSID/PWD
Device parses hot spot information
IOTX_AWSS_GOT_SSID_PASSWD
AP Connect
Device connects to AP
IOTX_AWSS_CONNECT_ROUTER
DHCP Get IP
Device gets IP address
IOTX_AWSS_GOT_IP
Cloud Connect
Successfully connected to the cloud.
Cloud Connected
One-click network provisioning
Network provisioning state
Command/Action
Expected log
Device reset
reset
start-----------hal
Dev Scan
awss
IOTX_AWSS_START
Awss Process
active_awss
IOTX_AWSS_ENABLE
Parse SSID/PWD
Device parses hot spot information
IOTX_AWSS_GOT_SSID_PASSWD
AP Connect
Device connects to AP
IOTX_AWSS_CONNECT_ROUTER
DHCP Get IP
Device gets IP address
IOTX_AWSS_GOT_IP
Cloud Connect
Cloud connection successful
Cloud Connected
Device hot spot network provisioning
Network provisioning state
Command/Action
Expected log
Device reset
reset
start-----------hal
Start device hot spot
dev_ap
ssid:adh_[pk]_[mac suffix]
Parse SSID/PWD
Device parses hot spot information
IOTX_AWSS_GOT_SSID_PASSWD
AP Connect
Device connects to AP
switch to ap:[ap ssid]
IOTX_AWSS_CONNECT_ROUTER
DHCP Get IP
Device gets IP address
Let's post GOT_IP event
Cloud Connect
Successfully connected to the cloud
Cloud Connected
Local timer feature
For more information about the local timer feature, see Develop the local timer feature on the device.
Note the following during development.
Ensure that you add the device-side timer (DeviceTimer) property on the Function Definition page.
NoteAfter you select the local timer feature in the Automation and Timer section of the Configure Human-Computer Interaction page, the platform automatically adds the DeviceTimer property on the Define Features page.
On the Interaction page, under Automation and Timers, select the check box for the local timer feature.
On the Human-Computer Interaction page, you can distinguish between local and cloud timers in the Device Panel. If your product uses local timers, you must explicitly specify the local timer component.

Local countdown feature
For more information about the local countdown feature, see Best practices for developing the local countdown feature.
Note the following during development.
Add the on-device timer (DeviceTimer) property to the product's Feature Definition page.
NoteAfter you select the local timer feature in the Automation and Timer section of the Configure Human-Computer Interaction page, the platform automatically adds the DeviceTimer property on the Define Features page.
On the Human-Computer Interaction page, under Automation and Timers, select the Local countdown timer check box.
In the Device Panel on the Human-Computer Interaction page, the selected panel uses a countdown list widget.
Third-party voice platforms
For information about connecting to the third-party voice platforms Amazon Alexa and Google Home, see the following documents.
Firmware OTA
The over-the-air (OTA) update process is the same for all private-brand project products, although the user interfaces of the Cloud Intelligence App and the Tmall Genie App differ. For more information, see Firmware OTA.
Mass produce devices
The previous section described the Bluetooth-assisted network provisioning solution, which requires you to write a device certificate to each device and ensure that the DeviceName is the same as the device's Wi-Fi MAC address. You can generate a test device certificate on the Device Debugging page by retrieving the Wi-Fi MAC address from a development board. This section describes how to generate and obtain device certificates for private-brand projects during the mass production phase. For more information about device mass production on the IoT Platform, see Mass Production Process and Mass Production Devices.
Upload MAC addresses and generate device certificates.
For products under a private-brand project, the IoT Platform does not provide MAC address segments. You must upload MAC addresses to use as the DeviceName for generating device certificates. Note that all letters in the MAC addresses must be in lowercase.
During programming, use the mass production programming tool to write the DeviceName and overwrite the chip's Wi-Fi MAC address. This ensures that the DeviceName and the Wi-Fi MAC address are the same.
When mass producing a private-brand project product, prepare a MAC address segment that meets the template requirements and upload it as a batch.

Download the generated device certificate checklist (CSV file).
Add the ProductSecret and ProductID to the device certificate (which includes ProductKey, DeviceName, and DeviceSecret by default).
The downloaded CSV device certificate checklist needs to be processed to generate a format that is compatible with the TG7100C batch programming tool.

Add the ProductSecret and ProductID to the device certificate checklist. The spelling and capitalization of
ProductSecret,ProductIDin the first row must be exact. You can use a text editor or write a text processing program to perform this task. Do not edit the file using Excel, because Excel may change the file format.
Program the device certificate.
On the Resource Download page of the T-Head Open Chip Community, download the 5-Tuple Mass Production Tool User Guide. Follow the instructions in the document to import the CSV file that contains the device certificates into the database and then start programming.







