In the IoT Platform console, you can import a Thing Specification Language (TSL) model to add multiple properties, events, and services. To import a TSL model, you can upload a TSL JSON file or copy a TSL model of another product to the current product. This topic describes how to add multiple TSL features at a time by importing a TSL model.
A product is created. For more information, see Create a product.
The previously defined features of the product are overwritten after you import a new TSL model. Proceed with caution when you run this command.
If the gateway connection protocol of a gateway sub-device product is Modbus, OPC UA, ZigBee, or BLE, you cannot import a TSL model for the product.
If a product is published, you cannot add or modify the TSL features of the product. To add or modify TSL features, you must unpublish the product.
If you import the TSL model of another product, the values of the Category parameter that are specified for the products must be the same.
Add TSL features
Log on to the IoT Platform console.
In the upper-left corner of the IoT Platform console, select the region where IoT Platform is activated.
On the All environment tab of the Overview page, find the instance that you want to manage and click the instance ID or instance name.
In the left-side navigation pane, choose Products.
On the Products page, find the product for which you want to add features and click View in the Actions column.
On the Product Details page, click the Define Feature tab, and then click Edit Draft.
Click Import. In the dialog box that appears, import a TSL model.
The following methods are supported:
On the Copy Product tab, select a source product and a TSL model version, and click OK.
The default module and custom modules of the TSL model version that you selected are imported from the source product. On the Define Feature tab, click Edit Draft. On the page that appears, find the TSL feature that you want to manage and click Edit to modify the feature.
On the Import TSL tab, upload a JSON file or a ZIP package that includes multiple JSON files.
For information about how to modify and package TSL files, see What is a TSL model?Note
If a file does not meet the requirements, a prompt is displayed to indicate that the verification fails when you upload the file to IoT Platform. Check and modify the file as prompted. Then, reupload the file. For more information about how to troubleshoot the issue, see What do I do if the verification fails when I import a TSL model file?
Publish a TSL model
A TSL model takes effect only after the model is published
Choose Define Feature > Edit Draft. In the lower left corner of the page that appears, click Release online. The Release model online? dialog box appears.
Optional. Click +Add post notes, and enter a version number and note.
The version number of the TSL model. You can manage the TSL model based on the version number.
The version number must be 1 to 16 characters in length, and can contain letters, digits, and periods (.).
The description of the TSL model. The description can contain letters, digits, and special characters. The description must be 1 to 100 characters in length.
If an online version is available, you must check the differences between the current version that you want to release and the online version.
Click View Differences. In the View Differences panel, you can view the differences between the versions. After you confirm the settings, click Confirm. In the Release model online? dialog box, the checkbox is automatically selected.
If you do not want to view the differences between the versions, select "Make sure that you have verified the differences between the current version and the online version."
Click OK to publish the TSL model.
After you publish a TSL model, you can view the published model in the IoT Platform console. You can perform the following operations on the Define Feature tab of the Product Details page:
Click TSL Model to view the TSL model in the JSON format.
Related API operations
Modifies a feature or the extended information about the TSL model of a product.
Queries the details of a TSL model of a product.
Copies the TSL model of a product to a destination product.
Publishes the TSL model of a product.
Imports a TSL model to a product. Extended information cannot be imported.
Queries the details of a published TSL model of a product.
What to do next
By default, TSL data that is submitted by the devices of a product is automatically written to a hot data storage space. You can stop the hot data storage service for some or all TSL models based on your business requirements.