In the IoT Platform console, you can add multiple properties, events, and services by importing a Thing Specification Language (TSL) model. To import a TSL model, you can upload a TSL JSON file or copy a TSL model of another product to the current product.

Usage notes

  • The previously defined features of the product is overwritten after you import a new TSL model. Proceed with caution.
  • If the gateway connection protocol of a gateway sub-device product is set to Modbus, OPC UA, ZigBee, or BLE, you cannot import a TSL model for the product.
  • If a product has been published, you cannot add or edit TSL features of the product. To add or edit 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 two products must be the same.

Procedure

  1. Log on to the IoT Platform console.
  2. In the left-side navigation pane, choose Devices > Products.
  3. On the Products page, find the product for which you want to add features, and click View in the Actions column.
  4. On the Product Details page, click the Define Feature tab, and then click Edit Draft.
  5. Click Import. In the dialog box that appears, import a TSL model.
    Import a TSL model

    The following two methods are available:

    • On the Copy Product tab, select a source product and a TSL model version. Click OK.

      The default module and custom modules of the TSL model version are imported. On the Define Feature tab, click Edit Draft. On the page that appears, find the required TSL feature 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 edit and package TSL files, see What is a TSL model?.

      Note If a file does not meet the requirements, the verification fails after the file is uploaded to IoT Platform. You must check and modify the file based on prompted instructions, and then upload the file again. For more information about how to troubleshoot issues, see What can I do if the verification fails when I import a TSL model file?.
  6. Release the TSL model.
    1. On the Edit Draft page, 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. It must be 1 to 100 characters in length.
    3. If an online version is available, you must check the differences between the current version and the online version.
      Click View Differences. In the View Differences dialog box, you can view the differences. After you confirm your settings, click Confirm. In the Release model online? dialog box, the checkbox is automatically selected.
    4. Click OK to release the TSL model.

Result

After you edit a TSL model, you must publish the TSL model to apply the update. On the Define Feature tab of the Product Details page, you can perform the following operations:

  • Click TSL Model to view the TSL model in the JSON format.

Related operations

Operation Description
UpdateThingModel Modifies a specified feature or extended information of the TSL model for a product.
QueryThingModel Queries the details of a TSL model for 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 for a product. Extended information cannot be imported.
QueryThingModelPublished Queries the details of a published TSL model for a product.