1-Integration via MQTT
TABLE OF CONTENTS
- Description
- Requirement
- Configuration
1-Integration via MQTT
Description
Cumulocity IoT is a leading IoT platform provided by Software AG, designed to help enterprises quickly achieve device connectivity, data collection, and intelligent analytics. It supports multiple protocols and device types, offering high scalability and flexibility to meet requirements ranging from small pilots to large-scale deployments. The platform includes rich applications and microservices such as device management, real-time data visualization, alarm handling, and remote control, significantly simplifying the development and operation of IoT solutions. Moreover, Cumulocity IoT supports edge computing and cloud collaboration, enabling users to achieve low latency and high-efficiency data processing. Its open API interfaces and powerful integration capabilities allow enterprises to easily merge IoT data with existing business systems, driving digital transformation and intelligent operations.
This document mainly introduces the complete process of connecting the UG65 gateway to the Cumulocity IoT platform and synchronizing AM319 device data from the Cumulocity IoT platform as an example.
Special Note:
The AM319 device mentioned here is only for demonstration purposes and does not imply that other types of sensors are not supported. Readers should refer to the steps according to their actual situations.
Requirement
- Gateway Model: UG65 (UG56, UG67 also supported)
Sensor Model: AM319
Gateway: Must already be connected to the Internet.
Configuration
Step 1: Register an Account
Visit Cumulocity | Cumulocity and click the “Try it free” button at the top right corner.
Fill in the basic information.
After submission, the platform will send an activation email to your registered email address, which includes the login URL, username, and initial password.
When logging in for the first time, you need to change the original password by following the platform's page instructions.
At this point, your account registration is complete, and you can log in and start using the platform.
Step 2: Obtain Basic Platform Information
Click the login URL in the email.
After logging in, perform the following operations as shown:
Click the “Download platform details” button:
You will download a JSON file.
Open it with a text editor, as shown below (this example is mine; readers should refer to their own information):Copy the parameters marked in red; they will be used in the subsequent steps.
Step 3: Gateway Configuration
a) Enable Built-in Network Server
First, log in to your gateway management interface (refer to <How to Login Web GUI of Milesight Gateway>).
Then operate as shown in the screenshots:If the status shows Embedded NS is Enabled and Connected, it means the Embedded NS is successfully enabled.
b) Add Sensor
Refer to <How to Connect LoRaWAN Nodes to Milesight Gateway> to add your sensor.
The completed result should look like this:
c) Enable Node-Red Function
Refer to <How to use Dashboard on Node Red of Milesight Gateway> to enable Node-Red.
After enabling, log into the gateway’s Node-Red interface as shown below:
Note:
The username and password here are the same as the gateway management interface.
d) Import Flow Example
Download the prepared example flow file from the following address:
http://resource.milesight-iot.com/Support/lockon/node-red-demos/Cumulocity-IoT-Demo.json
Then follow the screenshots below to import it into your local environment:
After successful import, you will see:
e) Detailed Explanation of the Example Flow
As shown:
The entire example is divided into two parts: Part A and Part B.
Main functions of Part A:
- Device Create devices remotely by calling APIs
- Update basic device information (serial number, device type, etc.)
- Debug testing
Main functions of Part B:
- Filter AM319 device data from the gateway
- Decode AM319 data
- Report data to the platform
- Define Alarm trigger rules and Rule trigger rules
Step 4: How to Use
Please modify in the following order:
- Change the “Device EUI” in “Filter out AM319 device data” to your actual device’s data.
- Modify the code inside “Decode AM319 device data” according to <How to Use Decoder on Node Red>. (If you use the AM319 sensor, you can use my code directly without modification.)
- Modify the connection information inside “Cumulocity Mqtt Connector” as shown:
The parameters here come from step 2. Modify according to the format shown in my screenshot with your own data.
- After modification, click “Update” and then “Deploy”. You will see the Cumulocity Mqtt Connector plugin turn green and show “connected” as below:
- Click the “Click to create a device on cloud” button:
- Wait about 1 minute.
- You will see the platform automatically create the device as shown:
- Wait another 10-15 minutes (usually based on your sensor’s reporting interval).
- You will see the device starts reporting real-time data normally, and the platform shows the device status as online and active:
Step 5: Example Dashboard
Here you can see the real-time updated data received from the AM319 device:
Step 6: Example Alarm
Here you can see the sensor’s alarm information displayed on the platform:
Step 7: Example Event
Here you can see the PIR change events reported by the sensor on the platform:
-END-