| Field | Value |
|---|---|
| Product | Robustel E2C Trinity (E2C Factory / E2C Field) |
| Document Type | Knowledge Base Article — How-to Guide |
| Intended Audience | Users who have already configured data collection in E2C Trinity and need to forward tag data to an MQTT broker |
| Prerequisites | This guide does not cover how to install or configure an MQTT broker. Before starting, obtain the broker address, port, authentication details, and certificates (if using TLS) from your MQTT administrator or cloud platform. |
| Tested Software | E2C Factory V2.1.4.1 |
| Tested Gateway OS | RobustOS Pro V2.4.2 |
| Tested Model | EG3120 |
| Last Verified | 2026-07-22 |
| Estimated Time | 20–30 minutes |
This article shows you how to publish tag data collected by E2C Trinity to an external MQTT broker. You will create a Tag Group, configure an MQTT Cloud Service, add a publish rule, and verify the data using MQTTX.
Stage 1 — Southbound Collection: E2C Trinity reads data from your industrial devices (PLC, sensor, meter, etc.) using protocols like Modbus TCP, OPC UA, or BACnet, and stores the values as internal "Tags."
Stage 2 — Northbound MQTT Publish (this guide): E2C Trinity connects to your MQTT broker as a client, packages the collected tags into JSON payloads, and publishes them to configured topics.
Stage 3 — Cloud Consumption: Your cloud platform (AWS IoT, Azure IoT Hub, or a custom application) subscribes to the MQTT topics and processes the data.
Note: E2C Trinity also supports Sparkplug B (an industrial IoT specification built on MQTT 3.1.1) and HTTP for cloud data forwarding. These are covered in separate articles.
If you are already familiar with MQTT, feel free to skip this section.
| Term | What It Means in Plain English |
|---|---|
| MQTT (Message Queuing Telemetry Transport) | A lightweight messaging protocol designed for IoT. Think of it as a "post office" system: devices publish messages to specific topics, and any system subscribed to that topic receives them instantly. |
| MQTT Broker | The central server that receives all messages and routes them to the right subscribers. Popular brokers include Mosquitto (open-source), EMQX, AWS IoT Core, and Azure IoT Hub. |
| Topic | A text string that acts as the "address" of a message. For example, factory/workshop-a/temperature tells the broker that this message contains temperature data from Workshop A. |
| QoS (Quality of Service) | Defines how reliably a message is delivered. QoS 0 = "fire and forget" (fastest). QoS 1 = "delivered at least once" (good balance). QoS 2 = "delivered exactly once" (slowest). |
| TLS (Transport Layer Security) | Encryption that secures the MQTT connection. Always use TLS when sending data over the public internet. |
| Tag Group | In E2C Trinity, a logical collection of data points (tags) that you organize together. MQTT publishes data by Tag Group — not by individual tags. |
| Client ID | A unique identifier for each MQTT client connecting to the broker. No two clients can share the same ID simultaneously. |
To make it easier to follow, all steps in this guide use the same example values:
| Item | Example |
|---|---|
| MQTT Broker | 192.168.0.100 |
| Port | 1883 |
| Cloud Service Name | MES_MQTT |
| Client ID | gateway-workshop-a-01 |
| Tag Group | Machine_Data |
| Report Interval | 10 seconds |
| Publish Topic | publish/machine |
| QoS | 0 |
Before beginning the configuration, make sure you have:
Security Notice: Public MQTT brokers (such as
broker.emqx.io) should only be used for testing with non-sensitive data. Do not publish production, customer, credential, or personally identifiable data to a public broker. Always use TLS when sending data over the public internet.
mosquitto_sub (command-line).Important: The screenshots use E2C Factory as an example. The workflow is also applicable to E2C Field, although some menu names or interface details may differ depending on the software version.
| Step | What You Will Do | Estimated Time |
|---|---|---|
| Step 1 | Verify that E2C Trinity is already collecting live tag data | 2 minutes |
| Step 2 | Create a Tag Group to organize the data points you want to publish | 5 minutes |
| Step 3 | Create an MQTT Cloud Service and test the connection to your broker | 10 minutes |
| Step 4 | Add a publish rule — choose which Tag Group to publish and under which MQTT topic | 5 minutes |
| Step 5 | Verify that your broker is receiving data using MQTTX | 3 minutes |
Skip ahead: If you already have a Tag Group with live tags, jump to Step 3.
Purpose: MQTT only forwards data that already exists as live tags. Before configuring anything, confirm that your data collection is working.
If you do not see live data, complete the device and tag configuration first. Refer to the relevant protocol guide (e.g., "How to Configure Modbus TCP Data Collection in E2C Factory") on the Robustel Support Center.
Purpose: E2C Trinity publishes data to MQTT by Tag Group — not by individual tags. You must create at least one Tag Group before configuring message publishing. Think of a Tag Group as a "folder" that bundles related tags for batch transmission.
| Parameter | Description | Example |
|---|---|---|
| Name | A recognizable name for this group of tags. | Machine_Data |
| Report Type | Period (fixed intervals), Change (only when a value changes), or Change & Period (both). | Period |
| Cycle Unit | Subsecond-level or Millisecond-level. | Subsecond-level (default) |
| Report Interval | Interval in seconds for periodic reporting. Range: 1–999999. | 10 |
| Description | Optional notes about this group's purpose. | Packaging machine production data |
Note: You can always add or remove tags later by selecting the group and using the Add and Batch Delete buttons.
Purpose: Create a connection in E2C Trinity that defines the target MQTT broker and how to connect to it.
MES_MQTT) and select MQTT as the Cloud Service Type. Click Save.| Parameter | Description | Example |
|---|---|---|
| Server Address | The IP address or domain name of your MQTT broker. | 192.168.0.100 |
| Port Number | The TCP port of your broker. Default is 1883 (non-TLS). For TLS, use the port specified by your broker administrator — commonly 8883. | 1883 |
| MQTT Client ID | A unique identifier for this gateway. Leave blank to auto-generate. | gateway-workshop-a-01 |
| Enable User Authentication | Turn on if your broker requires a username and password. | Enabled (if required) |
| Username / Password | Your broker credentials (appear when authentication is enabled). | e2c-gateway / your-password |
| Enable TLS | Turn on to encrypt the connection. Requires TLS certificates — see TLS Configuration below. | Enabled (recommended for cloud) |
| Clean Session | When enabled, the broker discards session state on disconnect. When disabled, the broker persists subscriptions and queued messages. | Enabled |
| MQTT Version | Select v3.1 or v3.1.1. v3.1.1 is recommended for most brokers. | v3.1.1 |
Critical Step: After completing the configuration, you must save and verify the connection.
Important: Gateway Time Synchronization
MQTT connections — especially TLS connections — rely on accurate timestamps. If the gateway's system clock is incorrect, the connection may fail.
To check and synchronize the gateway's time:
- In the gateway's Web GUI (RobustOS Pro), go to Services > NTP.
- Use the NTP tab to configure NTP servers (e.g.,
pool.ntp.org).- Use the Status tab to verify the System Time. If the Last Update Time shows "Not Updated," click Sync to manually synchronize.
For detailed instructions, refer to the RobustOS Pro Software Manual on the Robustel Support Center.
Purpose: Tell E2C Trinity which Tag Group to publish and under which MQTT topic.
| Parameter | Description | Example |
|---|---|---|
| Data Source Type | Select Tag Data to publish real-time tag values. | Tag Data |
| Group | Select the Tag Group you created in Step 2. | Machine_Data |
| Topic | The MQTT topic to publish to. | publish/machine |
| Topic Alias | A human-readable label for this topic in the rule list. | machine |
| QoS | 0 = at most once, 1 = at least once, 2 = exactly once. For high-frequency telemetry, QoS 0 is sufficient. | 0 |
Customizing the Payload Format: The Function Code panel allows you to write a JavaScript function to transform the data payload before publishing. If you leave the default
return msg;, the data is published in E2C Trinity's standard JSON format. For advanced customization, click View Help in the right-side panel for the full API reference.
Purpose: Confirm that the MQTT broker is receiving data from E2C Trinity.
Using MQTTX (desktop app — recommended):
publish/machine), and click Confirm.Each message follows this structure:
{
"groupName": "Machine_Data",
"groupTime": 1784633235145,
"messageId": "66b517bf-192c-4522-b08a-7b5087964d96",
"messageType": "normal",
"payload": {
"cycle_count": {
"deviceName": "A_Packaging_Machine",
"tag": "cycle_count",
"time": 1784633234000,
"value": "2780"
}
}
}
| Field | Description |
|---|---|
groupName | Name of the Tag Group that was published |
groupTime | Unix timestamp (milliseconds) when the group was published |
messageId | Unique message identifier (UUID v4) |
payload.{tag}.deviceName | Source device name |
payload.{tag}.tag | Tag name |
payload.{tag}.time | Unix timestamp (milliseconds) of the tag's last update |
payload.{tag}.value | Current tag value |
Note: The
valuefield is shown as a string in this example. Verify the output format for your tag data type and software version — the encoding may vary depending on the tag type.
If you see real-time data in the MQTT client, your configuration is complete.
| Issue | Possible Cause | Solution |
|---|---|---|
| Cloud Service Status shows "Disconnected" | The gateway cannot reach the broker, or the broker rejected the connection. | 1. Verify the Server Address and Port. Use the Ping tool in the gateway's System menu to check network reachability. 2. Check that the gateway's system time is synchronized (see NTP note in Step 3.2). An incorrect clock can cause TLS certificate validation to fail. 3. Check if a firewall is blocking the port. |
| Connected but no messages are received | No publish rule is configured, or the Tag Group is empty. | Verify that a publish rule has been added with a valid Tag Group assigned. Check that the Tag Group contains tags with live data (see Step 1 and Step 2). |
| Messages are received but values are null | The underlying tags are in an error state. | Go back to Data Collection and check the device and tag status. If a tag shows a red icon or null value, troubleshoot the southbound connection first. |
| Authentication failed | Wrong username or password. | Verify the credentials with your broker administrator. If the broker requires TLS, make sure TLS is enabled. |
| TLS connection fails | Certificate is invalid, not trusted, or wrong authentication method. | 1. Verify the correct Authentication Method is selected (CA Cert Auth or Mutual Cert Auth). 2. Check that certificate contents are complete and correctly pasted. 3. Ensure the gateway's system time is correct. |
| Broker rejects the Client ID | The Client ID is already in use by another client. | Change the Client ID to a unique value, or leave it blank to auto-generate. |
TLS (Transport Layer Security) encrypts the data between your gateway and the MQTT broker, preventing unauthorized access or tampering. When you enable TLS in the MQTT Cloud Service settings, you need to select an authentication method. Select the authentication method according to the requirements provided by your MQTT broker administrator — do not guess.
| Authentication Method | When It Is Used | What You Need |
|---|---|---|
| CA Cert Auth | The broker presents a certificate that must be verified against a trusted Certificate Authority (CA). This covers both public CAs (common for cloud brokers like AWS IoT or Azure IoT Hub) and private/self-signed CAs (common for self-hosted brokers like EMQX or Mosquitto). | The CA certificate file. For public CAs, download it from your cloud platform's documentation. For private/self-signed CAs, obtain it from your broker administrator or generate it using OpenSSL. |
| Mutual Cert Auth | The broker requires the client (gateway) to also present its own certificate to prove its identity. Used in high-security environments. | The CA certificate, plus a client certificate and client key pair issued by your broker administrator or cloud platform's device provisioning service. |
After selecting the method, paste the certificate contents into the corresponding fields and save the configuration.
A Last Will Message is a pre-defined message that the MQTT broker automatically publishes to a specified topic if the gateway disconnects unexpectedly — for example, due to a power failure or network outage. This allows your cloud platform or monitoring system to detect offline gateways.
To configure LWT, expand the Last Will Message section in the MQTT Cloud Service settings and specify:
gateway/status){"status": "offline"}By default, E2C Trinity publishes tag data in its standard JSON format (see the example in Step 5). If your cloud platform expects a different JSON structure, you can use the Function Code panel in the Add Publish window to write a JavaScript function that transforms the payload before publishing.
The function receives a msg parameter containing the tag data. You can use Edge.ReadTags() to read additional tag values, perform calculations, filter data, or restructure the JSON output. Other APIs are available for advanced logic. Click View Help in the right-side panel for the full API reference.
Sparkplug B is an industrial IoT data exchange specification built on top of MQTT 3.1.1. It adds standardized topic structures (e.g., spBv1.0/{Group ID}/DDATA/{Edge Node ID}/{Device ID}), binary Protobuf payloads, and device lifecycle state management (birth/death certificates). It is commonly used in SCADA and industrial platforms that require self-describing, interoperable data models.
To use Sparkplug B, create a new Cloud Service and select Sparkplug B as the type instead of MQTT. In the current E2C Trinity implementation, Sparkplug B uses a fixed reporting model and does not expose user-defined Topic, Last Will Message, or Clean Session settings.
The Standard MQTT configuration described in this guide can be used with MQTT 3.1/3.1.1-compatible brokers, provided that the broker's authentication, client ID, topic, and access-policy requirements are met. Guides for connecting E2C Trinity to specific cloud platforms and brokers — including AWS IoT Core, Azure IoT Hub, and EMQX — are planned for future release. For more E2C Trinity articles, visit the Robustel Knowledge Base.