Thing model format
About 2 min
1. Full thing model format
Tips
A thing model contains three categories: properties, services, and events. Each category can contain multiple model items. Thing models belong to products and are stored in Redis. Object types do not support nested objects, and parameters inside an object do not support array or object types.
{
"properties": [
{
"id": "Unique property identifier under the product",
"name": "Property name",
"isChart": "Whether to display the value in charts",
"isMonitor": "Whether to enable real-time monitoring",
"isHistory": "Whether to store historical records",
"isSharePerm": "Whether to use this item for device sharing permission control",
"isReadonly": "Whether the property is read-only",
"order": "Display order",
"datatype": {
"type": "bool. Supported types include integer, decimal, string, array, enum, and object",
"falseText": "Off",
"trueText": "On"
}
},
{
"id": "Unique property identifier under the product",
"name": "Property name",
"isChart": "Whether to display the value in charts",
"isMonitor": "Whether to enable real-time monitoring",
"isHistory": "Whether to store historical records",
"isSharePerm": "Whether to use this item for device sharing permission control",
"isReadonly": "Whether the property is read-only",
"order": 0,
"datatype": {
"type": "object",
"params": [
{
"id": "parentid_temperature",
"name": "Air temperature 2",
"isChart": "Whether to display the value in charts",
"isMonitor": "Whether to enable real-time monitoring",
"isHistory": "Whether to store historical records",
"isSharePerm": "Whether to use this item for device sharing permission control",
"isReadonly": "Whether the property is read-only",
"order": 0,
"datatype": {
"max": 120,
"min": -20,
"step": 0.1,
"type": "decimal",
"unit": "C"
},
"isMonitor": 1
}
]
}
},
{
"id": "Unique property identifier under the product",
"name": "Property name",
"isChart": "Whether to display the value in charts",
"isMonitor": "Whether to enable real-time monitoring",
"isHistory": "Whether to store historical records",
"isSharePerm": "Whether to use this item for device sharing permission control",
"isReadonly": "Whether the property is read-only",
"order": 0,
"datatype": {
"type": "string",
"maxLength": "1024"
}
},
{
"id": "Unique property identifier under the product",
"name": "Property name",
"isChart": "Whether to display the value in charts",
"isMonitor": "Whether to enable real-time monitoring",
"isHistory": "Whether to store historical records",
"isSharePerm": "Whether to use this item for device sharing permission control",
"isReadonly": "Whether the property is read-only",
"order": 0,
"datatype": {
"type": "array",
"arrayType": "object, including integer, decimal, and string",
"arrayCount": 5,
"params": [
{
"id": "parentid_light",
"name": "Illuminance 1",
"isChart": "Whether to display the value in charts",
"isMonitor": "Whether to enable real-time monitoring",
"isHistory": "Whether to store historical records",
"isSharePerm": "Whether to use this item for device sharing permission control",
"isReadonly": "Whether the property is read-only",
"order": 0,
"datatype": {
"max": 100,
"min": 0,
"step": 1,
"type": "decimal",
"unit": "mm"
},
"isMonitor": 1
}
]
}
}
],
"functions": [
{
"id": "Unique service identifier under the product",
"name": "Service name",
"isHistory": "Whether to store historical records",
"isSharePerm": "Whether to use this item for device sharing permission control",
"isReadonly": "Whether the service is read-only",
"order": 0,
"datatype": {
"type": "enum",
"enumList": [
{
"value": "1",
"text": "Normal"
},
{
"value": "-1",
"text": "Warning"
},
{
"value": "0",
"text": "Unknown"
}
]
}
}
],
"events": [
{
"id": "Unique event identifier under the product",
"name": "Event name",
"isHistory": "Whether to store historical records",
"isSharePerm": "Whether to use this item for device sharing permission control",
"order": 0,
"datatype": {
"type": "decimal",
"min": "-20",
"max": "55",
"unit": "C",
"step": "0.01"
}
}
]
}2. Compact thing model format
Tips
The compact format is used for device-platform interaction. Its id must match the thing model ID defined in the product.
[
{
"id": "temperature",
"name": "Temperature",
"value": "27.43",
"remark": "Remark",
"shadow": "27.43, representing the shadow value"
},
{
"id": "humidity",
"name": "Humidity",
"value": "32.18",
"remark": "Remark",
"shadow": "32.18"
},
{
"id": "CO2",
"name": "CO2",
"value": "11.04",
"remark": "Remark",
"shadow": "11.04"
},
{
"id": "group_gear",
"name": "Gear",
"value": "1",
"remark": "Remark",
"shadow": "0"
},
{
"id": "array_00_switch",
"name": "Switch",
"value": "1",
"remark": "Remark",
"shadow": "1"
}
]