All Products
Search
Document Center

IoT Platform:Batch add TSL features

Last Updated:Oct 08, 2023

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.

Prerequisites

A product is created. For more information, see Create a product.

Usage notes

  • 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

  1. Log on to the IoT Platform console.

  2. In the upper-left corner of the IoT Platform console, select the region where IoT Platform is activated.

  3. 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.

  4. In the left-side navigation pane, choose Products.

  5. On the Products page, find the product for which you want to add features and click View in the Actions column.

  6. On the Product Details page, click the Define Feature tab, and then click Edit Draft.

  7. 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

Important

A TSL model takes effect only after the model is published

  1. 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.

  2. Optional. Click +Add post notes, and enter a version number and note.

    Parameter

    Description

    Version Number

    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 (.).

    note

    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.

  3. 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."

  4. Click OK to publish the TSL model.

Execution result

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

API

Description

UpdateThingModel

Modifies a feature or the extended information about the TSL model of a product.

QueryThingModel

Queries the details of a TSL model of a product.

CopyThingModel

Copies the TSL model of a product to a destination product.

PublishThingModel

Publishes the TSL model of a product.

ImportThingModelTsl

Imports a TSL model to a product. Extended information cannot be imported.

QueryThingModelPublished

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.