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:
2. Cloud Operations – Create Cloud Device
2.1. Create Project
Click to create a project:
Fill in the information and submit:
After creation, the system will pop up the assigned application ID and secret key; you should click download and save it in time:
Next, click to enter the project, the interface after entering is as follows:
2.2. Create Product
Select to create a custom product:
Fill in the product information:
After successfully creating the product, as shown:
Next, we need to create the attributes and control commands for this device.
2.2.1. Create Device Attributes
Create a new service:
Add device brightness value attribute Lightness:
Edit the detailed information of the attribute value:
After setting is completed, it looks like this:
2.2.2. Create Issued Commands
Click to add a command:
Then add the fields of the issued command:
After adding, as shown:
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:
Fill in the basic information of the device reported data:
Add this message field:
First, add the address field of this message:
Then add the content field of this message:
The completed message fields are as follows:
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:
First, add the address field of this message:
Then add the content field of this message:
The completed message fields are as follows:
2.3.3. Set Codec Plugin Data Flow
2.3.4. Deploy Codec Plugin
3. Create Virtual Device to Test Codec Plugin
In the device management interface, click to create a virtual device:
Creation successful, click to debug the product:
The debugging interface is as follows:
Simulate data reporting in device simulation:
Device data reported successfully, next test the command issuance: