IoT Platform allows you to define a Thing Specification Language (TSL) model for a product. You can abstract product features into a data model that consists of properties, services, and events. This way, IoT Platform can manage the devices of products and exchange data with the devices in an efficient manner. After a product is created, you can define a TSL model for the product. The devices of the product automatically inherit the features from the TSL model.
PrerequisitesA product is created. For more information, see Create a product and add a device.
Background informationThis article describes how to define the Current and Main Light Switch TSL properties for the product to which a street lamp belongs. After you define the TSL model, you can add street lamps to the product. The street lamps automatically inherit the defined TSL model. For more information about TSL models, see What is a TSL model?.
- Log on to the IoT Platform console.
- On the Overview page, click the Public Instance card. Important If IoT Platform is activated in the China (Shanghai) or Japan (Tokyo) region, perform this step. If IoT Platform is activated in other regions, skip this step.
- In the left-side navigation pane, choose View in the Actions column.. In the product list, find the product and click
- On the Product Details page, click the Define Feature tab, and then click Edit Draft.
- In the Default Module section of the Define Feature page, click Add Self-defined Feature to configure the TSL feature and then click OK.Configure the Main Light Switch and Current properties, as shown in the following figures.
- Main Light Switch property
- Current property
- Optional. Click TSL Model. On the Full TSL tab, you can view the JSON file of the complete TSL model.
- Release the TSL model. Important 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.
- Click +Add post notes, and configure the Version Number and note parameters. The following table describes the parameters.
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.
- If an online version is available, you must check the differences between the 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.