This topic provides answers to some frequently asked questions (FAQ) about how to use Thing Specification Language (TSL) models to enable communication between devices and IoT Platform.
What do I do if verification fails when I import a TSL model file?
Issue
Verification errors occur when you import a TSL model file, as shown in the following figure. 
Solution
To fix the verification errors, use the following solutions:
Solution 1: Check the format of the TSL model file and make sure that the file is in the JSON format.
Solution 2: Click Download and View to obtain an errors.txt file. Troubleshoot and resolve the issues based on the errors.txt file.
For more information about the errors.txt file, see the following sample file.
Sample TSL model file:
{
"schema":"https://iotx-tsl.oss-ap-southeast-1.aliyuncs.com/schema.json",
"profile":{
"productKey":"a1Jk***"
},
"services":[],
"properties": 1,
"events": [],
"functionBlockId": "**mtest",
"functionBlockName": "Custom module 1"
}
Sample errors.txt file:
[
{
"path": [
"properties"
],
"property": "instance.properties",
"message": "is not of a type(s) array",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/propertyDefinition"
}
},
"instance": 1,
"name": "type",
"argument": [
"array"
],
"stack": "instance.properties is not of a type(s) array"
},
{
"path": [
"functionBlockId"
],
"property": "instance.functionBlockId",
"message": "does not match pattern \"^[_a-zA-Z0-9]{1,30}$\"",
"schema": {
"type": "string",
"pattern": "^[_a-zA-Z0-9]{1,30}$"
},
"instance": "**mtest",
"name": "pattern",
"argument": "^[_a-zA-Z0-9]{1,30}$",
"stack": "instance.functionBlockId does not match pattern \"^[_a-zA-Z0-9]{1,30}$\""
}
]
Parameter | Description |
path | The path of the error. In this example, the following errors are detected:
"path": [
"properties"
]
"path": [
"functionBlockId"
]
|
property | The invalid property in "path". For example, in "path": ["functionBlockId" ] , the value of the instance.functionBlockId property is invalid. |
message | The error message. For example, in "path": ["functionBlockId" ] , the error message does not match pattern \"^[_a-zA-Z0-9]{1,30}$\" is returned for the instance.functionBlockId property. |
schema | The rule that is used to verify the TSL model file. For example, in "path": ["functionBlockId" ] , the type and pattern rules are used. For more information about the rules, see schema. |
instance | The object that is verified. For example, in "path": ["functionBlockId" ] , the setting of "functionBlockId": "**mtest" is verified. |
name | The name of the rule that is not matched in the verification. For example, in "path": ["functionBlockId" ] , the value of **mtest does not match the pattern rule. |
argument | The content of the rule that is not matched in the verification. For example, in "path": ["functionBlockId" ] , the content of the pattern rule is ^[_a-zA-Z0-9]{1,30}$ . |
stack | The concatenated values of the property and message parameters. |
For more information, see jsonschema.
What are the differences among submitting property data, submitting historical data, and submitting multiple values of properties at the same time?
The following table describes the differences.
Operation | Description |
Submit property data | A device submits a snapshot of its property data to IoT Platform. The timestamp is optional in the submitted data. If the submitted data contains a timestamp, IoT Platform saves the timestamp to record the time when the property data is submitted. A device can submit property data with only one timestamp at a time. If the submitted property data does not contain a timestamp, IoT Platform generates a timestamp to record the time when the data is submitted.
|
Submit historical property data | A device submits the values of multiple properties to IoT Platform. The values are recorded at the same point in time. Timestamps must be specified in the submitted data. A device can submit values of multiple properties with different timestamps at a time. |
Submit multiple values of properties at a time | A device submits multiple values of a property to IoT Platform. The values are recorded at different points in time. Timestamps must be specified in the submitted data. A device can submit values of multiple properties with different timestamps at a time. |
After devices submit property data, historical data, or multiple values of properties, IoT Platform generates data records based on the timestamps.
Examples
In this example, the data of the temperature property is submitted by a device to IoT Platform.
Why is the TSL data of a device not updated in the IoT Platform console after the device submits the TSL data by using a custom topic?
Because a device must submit TSL data by using a TSL communication topic instead of using a custom topic. For more information, see Topics.
How do I obtain TSL data that is submitted by devices?
To obtain TSL data, use one of the following methods:
Server-side subscription: You can use the server-side subscription feature of IoT Platform to subscribe to messages of the Device Upstream Notification type. Then, IoT Platform forwards messages of the specified types from all devices in a product to a server based on your subscription settings. To configure a server-side subscription, use one of the following methods:
Data forwarding: You can configure data forwarding rules by using the data forwarding feature of the rules engine to forward device data to multiple Alibaba Cloud services. The services include Simple Message Queue (formerly MNS) (SMQ), ApsaraDB RDS, Tablestore (OTS), Function Compute, Lindorm, and Message Queue for Apache RocketMQ. For more information, see Data forwarding (old version) and Data forwarding (new version).
IoT Platform API operations
Why does the IoT Platform console not display the TSL data that is submitted by a device?
If the submitted TSL data does not require verification or fails to be verified, the TSL data is not displayed in the IoT Platform console. After a device submits TSL data to IoT Platform, IoT Platform verifies the data based on the specified verification type and the TSL definition. To view the TSL data of a device, perform the following steps: Log on to the IoT Platform console, find the device whose TSL data you want to view, and then click View in the Actions column. On the device details page, the TSL Data tab displays the TSL data. For more information, see Verify TSL data.
When you create a product, you must specify a verification type. For more information, see Create a product.
What do I do if the TSL data is not updated after IoT Platform successfully sends TSL property configuration requests and desired property values to devices?
To troubleshoot the issue, you can perform the following operations:
Device: Make sure that the device is connected to the IoT Platform. For more information about how to connect a device, see Download device SDKs.
Important
When IoT Platform successfully sends a request of configuring device properties to a device, the request is received but the device may not execute the request. After the device SDK responds to the property configuration request, the device must submit the latest property value to prove that the property value is changed.
You can also use the device simulator or MQTT.fx to simulate a device and connect the simulated device to IoT platform, and then debug messaging of the device online. For more information, see the following topics:
IoT Platform:
Make sure that you have the read and write permissions on the property that you want to manage to perform the Set and Set expectations operations.
Make sure that the messages that contain TSL data can be parsed properly.
This way, the latest TSL data can be displayed on the TSL Data tab in the IoT Platform console. For more information, see What is a TSL model? and Submit a script to parse TSL data.
You can perform the following operations to check whether the device received messages: Log on to the IoT Platform console, find the instance that you want to manage, and go to the Instance Details page. Choose Maintenance > Device Log > Cloud run log and view logs. For more information, see IoT Platform logs.