Unit 1: Registering a Device on EnOS


Before connecting a device to EnOS, you need to register the device on EnOS Application Portal, which includes defining the device model, creating a product, registering the device, and creating an asset tree for the device.


This tutorial uses a battery device as an example to show how to register a smart device that connects directly to EnOS Cloud.

Step 1: Defining a Model


A model is the abstraction of the features of an object that is connected to the Device Connectivity & Management. In EnOS, the device model defines the features of a device, including its attributes, measurement points, services, and events. For more information about models, see Basic Modeling: Designing and Creating Models.

  1. This step assumes that there is no existing device model to be reused on EnOS. Refer to Creating a Model from Scratch to create a new model from scratch and fill the information as follows:

    • Group: Custom(custom)

    • Name: battery

    • Business ID: battery

    • Model Usage: Device Connection

    • Description: Battery Model


    ../../_images/create_model1.png


  2. On the model details page, refer to Creating Model Elements to create the following attributes and measurement points:

    • Attribute

      • Category: Attribute

      • Name: brand

      • ID: brand

      • Data Type: String

      • Max length: 64

      • Unit: kWp

      • Default value: None

      • Is Required: Yes

      • Is Writable: Yes

    • Measurement Point

      • Category: Measurement Point

      • Name: temperature

      • ID: temperature

      • Point Type: AI

      • Data type: double

      • Aggregation: sum

      • Unit: kW

      • Quality Indicator: No

      • Is Writable: Yes

    • Command

      • Category: Command

      • Name: start_charging

      • IDr: start_charging

      • Input Parameter:

        • Name: result

        • ID: result

        • Data Type: object. Define the following parameters for the data type:

          • Parameter Name: point1

          • Parameter ID: point1

          • Data Type: integer

      • Output Parameter:

        • Name: point1

        • ID: point1

        • Data Type: object. Define the following parameters for the data type:

          • Parameter Name: point1

          • Parameter ID: point1

          • Data Type: integer


Once completed, you can use this model to create products and register devices.

Step 2: Creating a Product


A product is a collection of devices with the same features. Using the device model as a base, a product further defines the communication specifications for the device.


In this step, create a product called Battery_Product. It is assumed that a device of this product model sends data in JSON format and that the data transmission is not encrypted using the CA certificate.

  1. In EnOS Application Portal > Developer Console, select Device Management > Products.

  2. Click New Product, and enter the following in the New Product window.

    • Product Name: Battery_Product

    • Asset Type: Device

    • Model: battery

    • Onboarding Method: Only EnOS IoT.

    • Certificate-Based Authentication: Disabled

    • Description: Computer Battery

  3. Click OK to save the configuration.

    ../../_images/create_product1.png


For details about the configuration of a product, see Creating a Product.

Step 3: Registering a Device


A device is the instance of a product. It is created from a product so that it inherits not only the basic features of the model, but also the communication features of the product (for example, the device key-secret pair and device certificate used for secure communication).


In this step, create a device named battery1, which belongs to the Battery_Product created in the previous step.

  1. In EnOS Application Portal > Developer Console, select Device Management > Device Assets.

  2. Click New Device, and enter the following in the New Device window.

    • Basic Information:

      • Product: Battery_Product

      • Device Name: battery1

      • Device Key: Optional (it can be generated automatically by the system)

      • Timezone/City: UTC+08:00

    • Attributes:

      • brand: BrandName

  3. Click OK to save the configuration.


After you complete the device creation, find the created device from the device list, and click Viewbtn_view to enter the device details interface and obtain the device triplet ProductKey, DeviceKey and DeviceSecret, which will be used in the next step.


../../_images/register_device1.png


For details about device creation, see Registering a Device.

Next Unit


Unit 2: Connecting the Device to EnOS Cloud