The content of this page has been automatically translated by AI. If you encounter any problems while reading, you can view the corresponding content in Chinese.

Thing Model Definition

Last updated: 2025-04-27 17:29:29

Thing Model Overview

A Thing Model is a digital model defined by Tencent Cloud IoT Developer Platform for the same type of devices, that is, products. It digitally describes products through three feature types: properties, events, and actions.
Feature Type
Feature Description
Attribute
Various parameters and status data of the equipment during operation. For example, the temperature and humidity values collected by the Temperature and Humidity Sensor; the switch status values of electrical equipment, the current speed and latitude and longitude values collected by vehicle devices. Attributes support two types: read-write and read-only. Read-write means that the attribute can be reported from the device to the platform and can also be controlled from the platform. Read-only means that the attribute is only reported from the device to the platform.
Event
Data initiated by the device during runtime that requires the User Business System's awareness, including three event types: information, alarm, and failure. For example, when a device malfunctions, it is required to send the fault information and related data at the time of failure to the platform.
Behavior
The calling method provided by the device for applications, used by the business to initiate requests. It requires the device side to process and then return the processing result. Scenarios where the business system can synchronously or asynchronously obtain the result. For example:
Parking lot users need to be allowed to pass immediately after paying the parking fee. The business system needs to obtain whether the final status synchronization operation of the barrier is successful.
After a cloud printing scenario user issues a printing action, the input parameters of the action include order ID, print document content, etc., and the output parameters include the encoding of the print result.

Thing Model Category

The features of the product include standard features, custom functions, and advanced functions.
Feature Category
Feature Description
Standard feature
Standard features refer to the Thing Models of some common device categories provided by Tencent Cloud IoT Platform. Users can choose to use or not use these features as needed.
Custom function
Custom function refers to the feature provided by Tencent Cloud IoT Platform that allows users to freely define the Thing Model of products. Users can freely create, delete and edit Thing Model features according to the specifications and characteristics of the equipment.
Advanced Features
Advanced features refer to the value-added service features provided by Tencent Cloud IoT for users. For example, the tencent real-time communication (TRTC) service can be applied to visual intercom, Cloud Broadcasting real-time shouting, one-to-many emergency call scenarios; advanced features generally automatically generate corresponding standard features.

Operation Steps

Add Standard Features to Thing Model

The standard features are the default Thing Model definitions of preset device categories provided by Tencent Cloud IoT, as well as the default Thing Models corresponding to advanced features.
1. Log in to the IoT Explorer, enter the instance list page, and select the generated public instance.
2. Click on the enterprise instance, enter the instance page, click Product Development in the left menu, enter the product list, and select a certain "product" to enter Thing Model Definition.
3. Click Add Standard Function on the Standard Function tab.



4. The system-defined Thing Models of the same category as the user-selected category for other products can be added as needed by users. Once confirmed, the selected Thing Models will be added to the "custom function".

Custom Addition of Thing Model Attributes

Custom functions allow users to freely define the Thing Model according to device specifications, assigning users adequate freedom to define.
1. Log in to the IoT Explorer, enter the instance list page, and select the generated public instance.
2. Click the public instance to enter its details page. Click Product Development in the left menu to enter the product list, and choose a certain "product" to enter the Thing Model Definition.
3. Click the Add Custom Function button on the Custom Function tab page.



4. Select the "feature type" as needed in the popup window. For example, if a lighting product has an attribute switch, enter "Switch" as the feature name, and the identifier must be unique among all Thing Models of this product. Select the data type and then save.




Custom Addition of Thing Model Events

1. Log in to the IoT Explorer, enter the instance list page, and select the generated public instance.
2. Click the public instance to enter its details page. Click Product Development in the left menu to enter the product list, and choose a certain "product" to enter the Thing Model Definition.
3. Click the Add Custom Function button on the Custom Function tab page.
4. Select event as needed in the popup window. Then select "event type" again as "info". Users can freely define the event information that devices send to the IoT platform.




Custom Addition of Thing Model Actions

1. Log in to the IoT Development Platform, enter the instance list page, and select the generated public instance.
2. Click the public instance to enter its details page. Click Product Development in the left menu to enter the product list, and choose a certain "product" to enter the Thing Model Definition.
3. Click the Add Custom Function button on the Custom Function tab page.
4. Select action as needed in the popup window.
In self-service retail, shared payment or parking scenarios, it is often necessary for the business system to immediately perform operations such as opening doors, unlocking or opening barriers through the IoT platform after payment. This requires the business system to receive the processing results from the device end in real time. If it fails to respond promptly, the business system needs to cancel the transaction, such as initiating a refund.
5. Enter the corresponding action name and parameters for the feature name. The request parameters need to be defined by the user, and the response parameters are the parameters reported to the IoT platform after execution on the device side.
For example, the feature name is "Unlock", and the identifier is "Open". The request parameter customizes a string type of order ID, so that the business system can track the processing situation of each order on the device side; the response parameters can also add fields of order ID and the final unlock status result code of the device. If the unlock succeeds, return code 0, otherwise return 1. When the business system receives code 1, it can either retry if permitted by the business, or initiate a refund operation after multiple failures of retries when the payment has been completed.




Add Advanced Function Thing Model

Refer to the Advanced Features guide, purchase and activate the corresponding advanced features. Once enabled, the platform will add by default the Thing Model corresponding to the advanced features.

View Thing Model JSON Object

1. After adding standard features and custom functions, users can click View Thing Model JSON to view the JSON format corresponding to the Thing Model.



2. As shown below, users can copy or download the JSON Thing Model. The copied JSON can be used for copying the Thing Model definition between products through the "Import Thing Model" feature.




Import Thing Model

1. After copying the Thing Model JSON of a specific product, click Import Thing Model and paste the copied JSON into the text box.
2. Then click Import, which will override the original product's Thing Model. Note that the Thing Model import feature should be used with caution for products in mass production.




Thing Model Format Reference

The following is the JSON description of the Thing Model for the smart light, including various data types and event types. An example JSON is as follows:
{
"version": "1.0",
"profile": {
"ProductId": "2300UMK31M",
"CategoryId": "3"
},
"properties": [
{
"id": "power_switch",
"name": "light switch"
"desc": "Control the on and off of the light"
"required": true,
"mode": "rw",
"define": {
"type": "bool",
"mapping": {
"0": "Off"
"1": "On"
}
}
},
{
"id": "color",
"name": "color"
"desc": "Light color"
"mode": "rw",
"define": {
"type": "enum",
"mapping": {
"0": "Red",
"1": "Green",
"2": "Blue"
}
}
},
{
"id": "brightness",
"name": "brightness"
"desc": "Light brightness"
"mode": "rw",
"define": {
"type": "int",
"unit": "%",
"step": "1",
"min": "0",
"max": "100",
"start": "1"
}
},
{
"id": "name",
"name": "light position name"
"desc": "Light position name: study, living room, etc."
"mode": "rw",
"required": false,
"define": {
"type": "string",
"min": "0",
"max": "64"
}
}
],
"events": [
{
"id": "status_report",
"name": "DeviceStatus",
"desc": "Report the device status",
"type": "info",
"required": false,
"params": [
{
"id": "status",
"name": "running_state",
"desc": "Report current device running state",
"define": {
"type": "bool",
"mapping": {
"0": "normal",
"1": "fault"
}
}
},
{
"id": "message",
"name": "Message",
"desc": "Some extra message",
"define": {
"type": "string",
"min": "0",
"max": "64"
}
}
]
},
{
"id": "low_voltage",
"name": "LowVoltage",
"desc": "Alert for device voltage is low",
"type": "alert",
"required": false,
"params": [
{
"id": "voltage",
"name": "Voltage",
"desc": "Current voltage",
"define": {
"type": "float",
"unit": "V",
"step": "1",
"min": "0.0",
"max": "24.0",
"start": "1"
}
}
]
},
{
"id": "hardware_fault",
"name": "Hardware_fault",
"desc": "Report hardware fault",
"type": "fault",
"required": false,
"params": [
{
"id": "name",
"name": "Name",
"desc": "Name like: memory,tf card, censors ...",
"define": {
"type": "string",
"min": "0",
"max": "64"
}
},
{
"id": "error_code",
"name": "Error_Code",
"desc": "Error code for fault",
"define": {
"type": "int",
"unit": "",
"step": "1",
"min": "0",
"max": "2000",
"start": "1"
}
}
]
}
],
"actions": [
{
"id": "unlock",
"name": "Behavior detection for turning on the light"
Action for description of turning on the light
"input": [
{
"id": "open",
"name": "Switch"
"define": {
"type": "bool",
"mapping": {
"0": "Off"
"1": "On"
}
}
},
{
"id": "user",
"name": "User",
"define": {
"type": "string",
"min": "0",
"max": "2048"
}
}
],
"output": [
{
"id": "user",
"name": "user"
"define": {
"type": "string",
"min": "0",
"max": "2048"
}
},
{
"id": "time",
"name": "Light on time"
"define": {
"type": "timestamp"
}
},
{
"id": "state",
"name": "light status"
"define": {
"type": "bool",
"mapping": {
"0": "Off"
"1": "On"
}
}
}
],
"required": false
}
]
}

References

Learn about Thing Model Protocol. See Thing Model Protocol.
Viewing device attributes, events, and actions can be found in Device Debugging content.