Developing a Product Model Online

Overview

Before developing a product model online, you need to create a product. When creating a product, you need to enter information such as the product name, manufacturer name, industry, and device type. The product model uses the information as the values of device capability fields. The IoT platform provides standard models and vendor models. These models involve multiple domains and provide edited profile files. You can modify, add, or delete fields in the product model as required. If you want to custom a product model, you need to define a complete profile.

This section uses a product model that contains a service as an example. The product model contains services and fields in scenarios such as data reporting, command delivery, and command response delivery.

Procedure

  1. Log in to the IoTDA console.
  2. In the navigation pane, choose Products. In the product list, click the name of a product to access its details.
  3. On the Model Definition tab page, click Custom Model to add a service for the product.
  4. Specify Service ID, Service Type, and Description, and click OK.

    • Service ID: The first letter of the value must be capitalized, for example, WaterMeter and StreetLight.
    • Service Type: You are advised to set this parameter to the service ID.
    • Description: Define the properties of light intensity (Light_Intensity) and status (Light_Status).

    After the service is added, define the properties and commands in the Properties/Commands area. A service can contain properties and/or commands. Configure the properties and commands based on your requirements.

  5. In the property/command list, click Add Property. In the dialog box displayed, set property parameters and click OK.

    Parameter

    Description

    Property Name

    The value of Property Name must start with a letter. camelCase is recommended, for example, batteryLevel and internalTemperature.

    Mandatory

    You are advised to select this option.

    Data Type

    • int: Select this value if the reported data is an integer or Boolean value.
    • decimal: Select this value if the reported data is a decimal. You are advised to set this parameter to decimal when configuring the longitude and latitude properties.
    • string: Select this value if the reported data is a string, an enumerated value, or a Boolean value. If enumerated or Boolean values are reported, use commas (,) to separate the values.
    • dateTime: Select this value if the reported data is a date.
    • jsonObject: Select this value if the reported data is in JSON structure.

    Access Permissions

    • Read: You can query the property through APIs.
    • Write: You can modify the property value through APIs.
    • Execute: After the application subscribes to the data change notification, the device reports the property value, and the application receives the push notification.

    Value Range

    Set these parameters according to the actual situation of the device.

    Step

    Unit

  6. Click Add Command. In the dialog box displayed, set command parameters.

    • Command Name: The command name must start with a letter. It is recommended that you use uppercase letters and underscores (_) to separate words, for example, DISCOVERY and CHANGE_STATUS.
    • Downlink Parameter: Click Add Input Parameter. In the dialog box displayed, set the parameters of the command to be delivered and click OK.

      Parameter

      Description

      Parameter Name

      The parameter name must start with a letter. It is recommended that you capitalize the first letter of each word in a compound word except the first word, for example, valueChange.

      Mandatory

      You are advised to select this option.

      Data Type

      Set these parameters according to the actual situation of the device.

      Value Range

      Step

      Unit

    • Click Add Output Parameter to add parameters of a command response when necessary. In the dialog box displayed, set the parameters and click OK.

      Parameter

      Description

      Parameter Name

      The parameter name must start with a letter. It is recommended that you capitalize the first letter of each word in a compound word except the first word, for example, valueResult.

      Mandatory

      You are advised to select this option.

      Data Type

      Set these parameters according to the actual situation of the device.

      Value Range

      Step

      Unit