Updated on 2022-02-24 GMT+08:00

Fields in the Profile Sample

Device Capabilities

The devicetype-capability.json file records basic information about a device.

{
    "devices": [
        {
            "manufacturerId": "TestUtf8ManuId",
            "manufacturerName": "HZYB",
            "model": "NBIoTDevice",
            "protocolType": "CoAP",
            "deviceType": "WaterMeter",
            "omCapability":{ 
                          "upgradeCapability" : { 
                               "supportUpgrade":true,
                               "upgradeProtocolType":"PCP"
                         }, 
                         "fwUpgradeCapability" : {                  
                               "supportUpgrade":true,    
                               "upgradeProtocolType":"LWM2M"
                         },
                         "configCapability" : {                  
                               "supportConfig":true,
                               "configMethod":"file",
                               "defaultConfigFile": {
                                  "waterMeterInfo" : {
                                       "waterMeterPirTime" : "300"
                                   }
                               }
                         } 
             }, 
             "serviceTypeCapabilities": [
                {
                    "serviceId": "WaterMeterBasic",
                    "serviceType": "WaterMeterBasic",
                    "option": "Mandatory"
                },
                {
                    "serviceId": "WaterMeterAlarm",
                    "serviceType": "WaterMeterAlarm",
                    "option": "Mandatory"
                },
                {
                    "serviceId": "Battery",
                    "serviceType": "Battery",
                    "option": "Optional"
                },
                {
                    "serviceId": "DeliverySchedule",
                    "serviceType": "DeliverySchedule",
                    "option": "Mandatory"
                },
                {
                    "serviceId": "Connectivity",
                    "serviceType": "Connectivity",
                    "option": "Mandatory"
                }
            ]
        }
    ]
}

The fields are described as follows:

Field

Sub-field

Mandatory or Optional

Description

devices

     

Mandatory

Complete capability information about a device. (The root node cannot be modified.)

  

manufacturerId

  

Mandatory

Manufacturer ID of the device.

  

manufacturerName

  

Mandatory

Manufacturer name of the device. (The value must be in English.)

  

model

  

Mandatory

Device model. As a type of device may have multiple models, it is recommended that the value contain letters or digits to ensure scalability.

  

protocolType

  

Mandatory

Protocol used by the device to connect to the IoT platform. For example, the value is CoAP for NB-IoT devices.

  

deviceType

  

Mandatory

Type of the device.

  

omCapability

  

Optional

Software upgrade, firmware upgrade, and configuration update capabilities of the device. For details, see the description of the omCapability structure below.

If software or firmware upgrade is not involved, this field can be deleted.

  

serviceTypeCapabilities

  

Mandatory

Service capabilities of the device.

     

serviceId

Mandatory

Service ID. If a service type includes only one service, the value of serviceId is the same as that of serviceType. If the service type includes multiple services, the services are numbered correspondingly, such as Switch01, Switch02, and Switch03.

     

serviceType

Mandatory

Type of the service. The value of this field must be the same as that of serviceType in the servicetype-capability.json file.

     

option

Mandatory

Type of the service field. The value can be Master, Mandatory, or Optional.

This field is not a functional field but a descriptive one.

Description of the omCapability structure

Field

Sub-field

Mandatory or Optional

Description

upgradeCapability

  

Optional

Software upgrade capabilities of the device.

  

supportUpgrade

Optional

true: The device supports software upgrades.

false: The device does not support software upgrades.

  

upgradeProtocolType

Optional

Protocol type used by the device for software upgrades. It is different from protocolType of the device. For example, the software upgrade protocol of CoAP devices is PCP.

fwUpgradeCapability

  

Optional

Firmware upgrade capabilities of the device.

  

supportUpgrade

Optional

true: The device supports firmware upgrades.

false: The device does not support firmware upgrades.

  

upgradeProtocolType

Optional

Protocol type used by the device for firmware upgrades. It is different from protocolType of the device. Currently, the IoT platform supports only firmware upgrades of LWM2M devices.

configCapability

  

Optional

Configuration update capabilities of the device.

  

supportConfig

Optional

true: The device supports configuration updates.

false: The device does not support configuration updates.

  

configMethod

Optional

file: Configuration updates are delivered in the form of files.

  

defaultConfigFile

Optional

Default device configuration information (in JSON format). The specific configuration information is defined by the manufacturer. The IoT platform stores the information for delivery but does not parse the configuration fields.

Service Capabilities

The servicetype-capability.json file records service information about a device.

{
    "services": [
        {
            "serviceType": "WaterMeterBasic",
            "description": "WaterMeterBasic",
            "commands": [
                {
                    "commandName": "SET_PRESSURE_READ_PERIOD",
                    "paras": [
                        {
                            "paraName": "value",
                            "dataType": "int",
                            "required": true,
                            "min": 1,
                            "max": 24,
                            "step": 1,
                            "maxLength": 10,
                            "unit": "hour",
                            "enumList": null
                        }
                    ],
                    "responses": [
                        {
                            "responseName": "SET_PRESSURE_READ_PERIOD_RSP",
                            "paras": [
                                {
                                    "paraName": "result",
                                    "dataType": "int",
                                    "required": true,
                                    "min": -1000000,
                                    "max": 1000000,
                                    "step": 1,
                                    "maxLength": 10,
                                    "unit": null,
                                    "enumList": null
                                }
                            ]
                        }
                    ]
                }
            ],
            "properties": [
                {
                    "propertyName": "registerFlow",
                    "dataType": "int",
                    "required": true,
                    "min": 0,
                    "max": 0,
                    "step": 1,
                    "maxLength": 0,
                    "method": "R",
                    "unit": null,
                    "enumList": null
                },
                {
                    "propertyName": "currentReading",
                    "dataType": "string",
                    "required": false,
                    "min": 0,
                    "max": 0,
                    "step": 1,
                    "maxLength": 0,
                    "method": "W",
                    "unit": "L",
                    "enumList": null
                },
                {
                    "propertyName": "timeOfReading",
                    "dataType": "string",
                    "required": false,
                    "min": 0,
                    "max": 0,
                    "step": 1,
                    "maxLength": 0,
                    "method": "W",
                    "unit": null,
                    "enumList": null
                },
                {
                    "propertyName": "internalTemperature",
                    "dataType": "int",
                    "required": false,
                    "min": 0,
                    "max": 0,
                    "step": 1,
                    "maxLength": 0,
                    "method": "W",
                    "unit": "0.01°C",
                    "enumList": null
                },
                {
                    "propertyName": "dailyFlow",
                    "dataType": "int",
                    "required": false,
                    "min": 0,
                    "max": 0,
                    "step": 1,
                    "maxLength": 0,
                    "method": "W",
                    "unit": "L",
                    "enumList": null
                },
                {
                    "propertyName": "dailyReverseFlow",
                    "dataType": "int",
                    "required": false,
                    "min": 0,
                    "max": 0,
                    "step": 1,
                    "maxLength": 0,
                    "method": "W",
                    "unit": "L",
                    "enumList": null
                },
                {
                    "propertyName": "peakFlowRate",
                    "dataType": "int",
                    "required": false,
                    "min": 0,
                    "max": 0,
                    "step": 1,
                    "maxLength": 0,
                    "method": "W",
                    "unit": "L/H",
                    "enumList": null
                },
                {
                    "propertyName": "peakFlowRateTime",
                    "dataType": "string",
                    "required": false,
                    "min": 0,
                    "max": 0,
                    "step": 1,
                    "maxLength": 0,
                    "method": "W",
                    "unit": null,
                    "enumList": null
                },
                {
                    "propertyName": "intervalFlow",
                    "dataType": "array",
                    "required": false,
                    "min": 0,
                    "max": 0,
                    "step": 1,
                    "maxLength": 0,
                    "method": "W",
                    "unit": "L",
                    "enumList": null
                },
                {
                    "propertyName": "pressure",
                    "dataType": "array",
                    "required": false,
                    "min": 0,
                    "max": 0,
                    "step": 1,
                    "maxLength": 0,
                    "method": "W",
                    "unit": "kPa",
                    "enumList": null
                },
                {
                    "propertyName": "temperature",
                    "dataType": "array",
                    "required": false,
                    "min": 0,
                    "max": 0,
                    "step": 1,
                    "maxLength": 0,
                    "method": "W",
                    "unit": "0.01°C",
                    "enumList": null
                },
                {
                    "propertyName": "vibration",
                    "dataType": "array",
                    "required": false,
                    "min": 0,
                    "max": 0,
                    "step": 1,
                    "maxLength": 0,
                    "method": "W",
                    "unit": "0.01g",
                    "enumList": null
                }
            ]
        }
    ]
}

The fields are described as follows:

Field

Sub-field

Mandatory or Optional

Description

services

           

Mandatory

Complete information about a service. (The root node cannot be modified.)

  

serviceType

        

Mandatory

Type of the service. The value of this field must be the same as that of serviceType in the devicetype-capability.json file.

  

description

        

Mandatory

Description of the service.

This field is not a functional field but a descriptive one. It can be set to null.

  

commands

        

Mandatory

Command supported by the device. If the service has no commands, set the value to null.

     

commandName

     

Mandatory

Name of the command. The command name and parameters together form a complete command.

     

paras

     

Mandatory

Parameters contained in the command.

        

paraName

  

Mandatory

Name of a parameter in the command.

        

dataType

  

Mandatory

Data type of the parameter in the command.

Value: string, int, string list, decimal, DateTime, or jsonObject

Complex types of reported data are as follows:

  • string list: ["str1","str2","str3"]
  • DateTime: The value is in the format of yyyyMMdd'T'HHmmss'Z', for example, 20151212T121212Z.
  • jsonObject: The value is in customized JSON format, which is not parsed by the IoT platform but is transparently transmitted only.
        

required

  

Mandatory

Whether the command is mandatory. The value can be true or false. The default value is false, indicating that the command is optional.

This field is not a functional field but a descriptive one.

        

min

  

Mandatory

Minimum value.

This field is valid only when dataType is set to int or decimal.

        

max

  

Mandatory

Maximum value.

This field is valid only when dataType is set to int or decimal.

        

step

  

Mandatory

Step.

This field is not used. Set it to 0.

        

maxLength

  

Mandatory

Character string length.

This field is valid only when dataType is set to string, string list, or DateTime.

        

unit

  

Mandatory

Unit.

The value is determined by the parameter, for example:

Temperature unit: C or K

Percentage unit: %

Pressure unit: Pa or kPa

        

enumList

  

Mandatory

List of enumerated values.

For example, the status of a switch can be set as follows:

"enumList": ["OPEN","CLOSE"]

This field is not a functional field but a descriptive one. It is recommended that this field be defined accurately.

     

responses

     

Mandatory

Responses to command execution.

        

responseName

  

Mandatory

You can add _RSP to the end of commandName in the command corresponding to responses.

        

paras

  

Mandatory

Parameters contained in a response.

           

paraName

Mandatory

Name of a parameter in the command.

           

dataType

Mandatory

Data type.

Value: string, int, string list, decimal, DateTime, or jsonObject

Complex types of reported data are as follows:

  • string list: ["str1","str2","str3"]
  • DateTime: The value is in the format of yyyyMMdd'T'HHmmss'Z', for example, 20151212T121212Z.
  • jsonObject: The value is in customized JSON format, which is not parsed by the IoT platform but is transparently transmitted only.
           

required

Mandatory

Whether the command response is mandatory. The value can be true or false. The default value is false, indicating that the command response is optional.

This field is not a functional field but a descriptive one.

           

min

Mandatory

Minimum value.

This field is valid only when dataType is set to int or decimal. The value of a field of the int or decimal type must be greater than or equal to the value of min.

           

max

Mandatory

Maximum value.

This field is valid only when dataType is set to int or decimal. The value of a field of the int or decimal type must be less than or equal to the value of max.

           

step

Mandatory

Step.

This field is not used. Set it to 0.

           

maxLength

Mandatory

Character string length.

This field is valid only when dataType is set to string, string list, or DateTime.

           

unit

Mandatory

Unit.

The value is determined by the parameter, for example:

Temperature unit: C or K

Percentage unit: %

Pressure unit: Pa or kPa

           

enumList

Mandatory

List of enumerated values.

For example, the status of a switch can be set as follows:

"enumList": ["OPEN","CLOSE"]

This field is not a functional field but a descriptive one. It is recommended that this field be defined accurately.

  

properties

        

Mandatory

Reported data. Each sub-node indicates a property.

     

propertyName

     

Mandatory

Name of the property.

     

dataType

     

Mandatory

Data type.

Value: string, int, string list, decimal, DateTime, or jsonObject

Complex types of reported data are as follows:

  • string list: ["str1","str2","str3"]
  • DateTime: The value is in the format of yyyyMMdd'T'HHmmss'Z', for example, 20151212T121212Z.
  • jsonObject: The value is in customized JSON format, which is not parsed by the IoT platform but is transparently transmitted only.
     

required

     

Mandatory

Whether the property is mandatory. The value can be true or false. The default value is false, indicating that the property is optional.

This field is not a functional field but a descriptive one.

     

min

     

Mandatory

Minimum value.

This field is valid only when dataType is set to int or decimal. The value of a field of the int or decimal type must be greater than or equal to the value of min.

     

max

     

Mandatory

Maximum value.

This field is valid only when dataType is set to int or decimal. The value of a field of the int or decimal type must be less than or equal to the value of max.

     

step

     

Mandatory

Step.

This field is not used. Set it to 0.

     

method

     

Mandatory

Access mode.

  • R: readable
  • W: writable
  • E: subscription

Value: R, RW, RE, RWE, or null

     

unit

     

Mandatory

Unit.

The value is determined by the parameter, for example:

Temperature unit: C or K

Percentage unit: %

Pressure unit: Pa or kPa

     

maxLength

     

Mandatory

Character string length.

This field is valid only when dataType is set to string, string list, or DateTime.

     

enumList

     

Mandatory

List of enumerated values.

For example, batteryStatus can be set as follows:

"enumList" : [0, 1, 2, 3, 4, 5, 6]

This field is not a functional field but a descriptive one. It is recommended that this field be defined accurately.