Creating Models for Battery Devices for Device Integration


When integrating devices into the IoT, a model needs to be created to abstract functions across dimensions such as attributes, measurement points, commands, and events. This tutorial will guide you on how to configure a model for smart devices. The constructed model will be used for device integration.

Job Description


This job uses the battery device integration scenario as an example to guide device integration and management personnel in configuring and using model management for battery devices before their integration.


Operation Personnel

Operation Location

Device Integration and Management Personnel

Application Portal


The overall process includes:

  1. Predefine Model Elements

  2. Create Model

  3. Configure Model

Prerequisites


Before starting, ensure the following:

Step 1: Predefining Model Elements


In this job, the model element which needs to be referenced multiple times is the brand of the battery device.

  1. Log in to the Application Portal, select the target application, and navigate to Model Element Library.

  2. In the top-left corner, click Elements Created in This OU > Property > New Property. On the New Property page, configure the following information as prompted, including.

    Type

    Name

    ID

    Data Type

    Maximum Length

    Description

    Attribute

    brand

    brand

    String

    64 characters

    Information about the device’s brand

  3. Select Save to complete the predefined model element.

Step 2: Creating Models


  1. In the Developer Console of the Application Portal, select Model.

  2. Click Models Created in This OU > New Model in the top left of the page and configure the model attributes as prompted, including:

    • Group: Custom

    • Name: battery

    • Business ID: battery

    • Model Usage: Device Integration

    • Description: Battery Model


    Note

    Models under the Custom group are only available to the current OU. The model created in this job is project-specific and does not need to be shared with other OUs. To share the model with other OUs, contact your enterprise tenant administrator to request a model group and select the corresponding model group in this step. For detailed steps on sharing models, refer to Managing Sharing Strategies.


  3. Select Configure Model to enter the configuration page.

Step 3: Configuring Models


  1. On the model definition page, click New > Property, and create the following measurement points in the New Property window:

    Type

    Name

    ID

    Measurement Point Type

    Data Type

    Description

    Measurement Point

    temperature

    temperature

    AI

    double

    Measurement point for collecting the device’s temperature


  2. On the model definition page, click New > Command, and create the following command in the New Command window:

    • Type: Command

    • Name: Control Device Charging State

    • ID: control_charging

    • Input/Output Parameters:


    Parameter Type

    Parameter Name

    Identifier

    Data Type

    Input

    result

    result

    Int

    Output

    point1

    point1

    Int

  3. Return to the model definition page, click > Reference to the right of New, and reference the following attribute in the Reference Property window:

    • Name: brand

    • Identifier: brand

  4. Click Next > OK to save the referenced attributes.

Next


After completing this job, proceed to configure the integration information for the battery device. When creating the product, check the Battery model. For specific operations, refer to Connecting a Simulated Device to EnOS.