Creating CoAP Products on Huawei OC Platform

1. Cloud Preparation – Register and Log in to OC Platform

Register and log in to the Huawei OceanConnect platform using a Huawei Cloud account.

The interface after entering is as follows:

Creating CoAP Products on Huawei OC Platform

2. Cloud Operations – Create Cloud Device

2.1. Create Project

Click to create a project:

Creating CoAP Products on Huawei OC Platform

Fill in the information and submit:

Creating CoAP Products on Huawei OC Platform

After creation, the system will pop up the assigned application ID and secret key; you should click download and save it in time:

Creating CoAP Products on Huawei OC Platform

Next, click to enter the project, the interface after entering is as follows:

Creating CoAP Products on Huawei OC Platform

2.2. Create Product

Creating CoAP Products on Huawei OC Platform

Select to create a custom product:

Creating CoAP Products on Huawei OC Platform

Fill in the product information:

Creating CoAP Products on Huawei OC Platform

After successfully creating the product, as shown:

Creating CoAP Products on Huawei OC Platform

Next, we need to create the attributes and control commands for this device.

2.2.1. Create Device Attributes

Create a new service:

Creating CoAP Products on Huawei OC Platform

Add device brightness value attribute Lightness:

Creating CoAP Products on Huawei OC Platform

Edit the detailed information of the attribute value:

Creating CoAP Products on Huawei OC Platform

After setting is completed, it looks like this:

Creating CoAP Products on Huawei OC Platform

2.2.2. Create Issued Commands

Click to add a command:

Creating CoAP Products on Huawei OC Platform

Creating CoAP Products on Huawei OC Platform

Then add the fields of the issued command:

Creating CoAP Products on Huawei OC Platform

Creating CoAP Products on Huawei OC Platform

After adding, as shown:

Creating CoAP Products on Huawei OC Platform

A completed product has been created.

2.3. Create Codec Plugin

Devices using the CoAP protocol need to improve data parsing, converting the binary data reported by the device into JSON data format on the platform.

2.3.1. Add Device Messages

Click on codec plugin development, then click to add a new message:

Creating CoAP Products on Huawei OC Platform

Fill in the basic information of the device reported data:

Creating CoAP Products on Huawei OC Platform

Add this message field:

Creating CoAP Products on Huawei OC Platform

First, add the address field of this message:

Creating CoAP Products on Huawei OC Platform

Then add the content field of this message:

Creating CoAP Products on Huawei OC Platform

The completed message fields are as follows:

Creating CoAP Products on Huawei OC Platform

2.3.2. Add Issued Command Messages

Click on codec plugin development, click to add a new message, and fill in the basic information of the issued command data:

Creating CoAP Products on Huawei OC Platform

First, add the address field of this message:

Creating CoAP Products on Huawei OC Platform

Then add the content field of this message:

Creating CoAP Products on Huawei OC Platform

The completed message fields are as follows:

Creating CoAP Products on Huawei OC Platform

2.3.3. Set Codec Plugin Data Flow

Creating CoAP Products on Huawei OC Platform

Creating CoAP Products on Huawei OC Platform

2.3.4. Deploy Codec Plugin

Creating CoAP Products on Huawei OC Platform

3. Create Virtual Device to Test Codec Plugin

In the device management interface, click to create a virtual device:

Creating CoAP Products on Huawei OC Platform

Creation successful, click to debug the product:

Creating CoAP Products on Huawei OC Platform

The debugging interface is as follows:

Creating CoAP Products on Huawei OC Platform

Simulate data reporting in device simulation:

Creating CoAP Products on Huawei OC Platform

Device data reported successfully, next test the command issuance:

Creating CoAP Products on Huawei OC Platform

Creating CoAP Products on Huawei OC Platform

Leave a Comment