A Thing Specification Language (TSL) model is a data model that is defined for a product in IoT Platform. A TSL model is used to describe the features of a product. This article describes the concepts and limits of a TSL model.

Overview

A TSL model digitizes a physical entity in the cloud, such as a sensor, vehicle-mounted device, building, or factory. A TSL model includes the properties, services, and events of an entity. A TSL model describes what the entity is, what the entity can do, and what information the entity can provide. You can define the TSL features of a product from the dimensions of properties, services, and events.

Feature type Description
Property Defines the capabilities of devices that can be read and set. Properties are used to describe a type of data that devices can collect, such as the temperature data that is collected by an environmental sensor. Properties support the GET and SET request methods. Applications can send requests to retrieve and set properties.
Service Defines the capabilities or methods of devices that can be called by applications. You can configure input and output parameters. Services also define the features that can be used by IoT Platform. Compared with properties, services can be called by using a command to implement complex business logic. For example, you can call a service to perform a specific task.
Event Defines the events that devices automatically send to IoT Platform when the devices are running. An event contains a notification that requires action or attention. An event may contain multiple output parameters. For example, an event may be a notification that a task is completed, a device fault has occurred, or a temperature alert is generated. You can subscribe to or push events.

IoT Platform supports defining multiple sets of features for a product, including properties, services, and events. A TSL module indicates a set of features. Different TSL modules do not affect each other.

TSL modules allow you to resolve complex device modeling issues in industrial scenarios. You can develop devices of different features by using the same product.

For example, the properties of the electric fan heater product include Power Switch, Gear (high, medium, and low), and Indoor Temperature. You can add the first two properties in one module and all three properties in another module. Then, you can develop devices based on TSL modules. This way, different devices under the same product have different features.

IoT Platform provides default modules. You can add custom modules as needed. The total number of modules cannot exceed 10.

Notice The features that were defined before January 1, 2021 are categorized into default modules.

Usage notes

IoT Platform provides TSL to describe modules and features of products.

Each TSL file is in the JSON format. You can view or export a JSON-formatted TSL model in the IoT Platform console. On the Product Details page, click the Define Feature tab. On this tab, click TSL Model. For more information about TSL fields, see TSL parameters.

You can add one or more TSL models in IoT Platform. When you import multiple TSL models at the same time, you can customize TSL files. For more information about limits, see Limits.

Limits

For information about the limits of TSL features, see Limits. The following table describes the limits that apply when you import TSL files.

Type Limits
Import a single TSL file The file suffix is .json. The file must be in the JSON format. The file size cannot exceed 256 KB.
Import multiple TSL files
  • Multiple TSL files must be compressed into a .zip file. The size of the ZIP file cannot exceed 2.5 MB. The ZIP file can be decompressed. Each TSL file after being decompressed must follow the required data format.
  • The ZIP file must contain at least one valid TSL file. The ZIP file can contain a maximum of one default module file, and nine custom module files.
    Notice The functionBlockName and functionBlockId parameters in custom module files must be unique.

References