MQTT Client / MQTT Client Custom Payload
In this video of our N3uron Academy, we’ll show you how to configure a Custom Payload for the N3uron MQTT Client module. Let’s get started!
[09:29] Configuring MQTT Client
[06:30] MQTT Client Custom Parser
[04:07] MQTT Client Custom Payload
[05:57] Connecting MQTT Client to AWS
[04:46] Connecting MQTT Client to Azure
[00:00] Hello everyone! In this video, we’ll show you how to configure a Custom Payload for the N3uron MQTT Client module. While the MQTT Client Publisher comes with preconfigured serialization formats for JSON, InfluxDB, and Protobuf, we’ll demonstrate how to create a custom serialization for your Custom Payload using the broker configuration connection we established in the MQTT Client Configuration video. First, let’s walk through our objective. On the screen, you can see we’re receiving real-time data from an OPC-UA Client subscription connected to an OPC-UA Server at a Photovoltaic Plant. As depicted in this diagram, our goal is to format the MQTT Publisher payload for all the events generated by these tags. Notice how the tag paths, which are typically separated by forward slashes, have been converted to use dots instead.
[01:04] The payload contains key-value pairs for tagName, value, quality, and timestamp. The quality field is a string that indicates the status, either GOOD or BAD, along with its code, while the timestamp is shown as a localized date string. To get started, navigate to the “Config” tab under “System,” select “Modules,” and locate the Mosquitto connection we set up earlier. Right-click on the connection, select “New Publisher,” assign it a name such as “CustomPublisher,” and configure it within the existing Mosquitto broker connection. Now, let’s configure the publisher’s topic as PV-PLANT and set the message format. While the MQTT Client Publisher supports JSON, InfluxDB, and Protobuf, we’ll use “Custom” to define our own payload. We’ll keep the encoding as UTF-8 and disable compression. With this setup, we can now script the payload structure to format event data before publishing it to the MQTT broker.
[02:02] A default script template is provided, but we will modify it. Now, let’s break down how our custom payload script processes the data before publishing it. First, the script logs the raw input events for debugging. It then reformats each event by adjusting the tag name—removing the first forward slash and replacing the rest with dots—before assigning the event value to the value key. Next, it formats the quality field by categorizing it as “GOOD” or “BAD” based on its value, appending the corresponding quality code for clarity. The timestamp is also converted into a localized ISO-String format. Once all transformations are complete, the script logs the modified output for debugging, converts the response into a JSON string, and sets it as the final output. Finally, we save the script changes and create a tag filter for the publisher, which, in this case, is set to include the entire data model. Once everything is configured, save and apply the changes.
[03:01] Then, navigate to Diagnostics, enable Real-Time Logs, select the MQTT Client module, and verify that messages are being published. To ensure everything is working, use a third-party MQTT client to subscribe to the topic and inspect the published messages. You should see the Custom Payload formatted exactly as intended. And that’s it! We’ve successfully set up a Custom Payload for the N3uron MQTT Client, allowing for a more tailored publishing payload beyond the pre-configured options. Thanks for watching!
N3uron software is an Industrial Edge Platform for IIoT and DataOps that streamlines the flow of data between industrial systems and business applications, either on-premise or in the cloud. N3uron provides an out-of-the-box solution for data standardization, normalization and contextualization, seamless integration with industrial and IT systems, efficient information management, and unparalleled scalability and security. The N3uron platform makes it easier for operations teams to aggregate, manage and analyze industrial data, resulting in enhanced productivity and informed decision-making. Whether you're looking to optimize your operations, reduce downtime or improve product quality, the N3uron platform is the answer.
CONTRIBUTING MEMBER
N3uron is a Contributing Member of the Eclipse Foundation, actively participating in the development of their robust ecosystem. By leveraging EF technologies, we offer innovative products and services that drive our corporate strategy forward. N3uron is Sparkplug Compatible Software.
DLMS® UA MEMBER
N3uron is a member of the DLMS® User Association, the global community that drives standardization in the energy and water industry. Being part of the DLMS UA represents N3uron's commitment to advancing smart metering and energy management solutions.
FOLLOW US
N3uron Connectivity Systems • Paseo de la Castellana, 91, 4º, 1; Madrid, 28046, Spain • +34 911 841 938 • [email protected]
N3uron software is an Industrial Edge Platform for IIoT and DataOps that streamlines the flow of data between industrial systems and business applications, either on-premise or in the cloud. N3uron provides an out-of-the-box solution for data standardization, normalization and contextualization, seamless integration with industrial and IT systems, efficient information management, and unparalleled scalability and security. The N3uron platform makes it easier for operations teams to aggregate, manage and analyze industrial data, resulting in enhanced productivity and informed decision-making. Whether you're looking to optimize your operations, reduce downtime or improve product quality, the N3uron platform is the answer.
CONTRIBUTING MEMBER
N3uron is a Contributing Member of the Eclipse Foundation, actively participating in the development of their robust ecosystem. By leveraging EF technologies, we offer innovative products and services that drive our corporate strategy forward. N3uron is Sparkplug Compatible Software.
CONTRIBUTING MEMBER
N3uron is a Contributing Member of the Eclipse Foundation, actively participating in the development of their robust ecosystem. By leveraging EF technologies, we offer innovative products and services that drive our corporate strategy forward. N3uron is Sparkplug Compatible Software.
FOLLOW US
N3uron Connectivity Systems • Paseo de la Castellana, 91, 4º, 1; Madrid, 28046, Spain • +34 911 841 938 • [email protected]
N3uron software is an Industrial Edge Platform for IIoT and DataOps that streamlines the flow of data between industrial systems and business applications, either on-premise or in the cloud. N3uron provides an out-of-the-box solution for data standardization, normalization and contextualization, seamless integration with industrial and IT systems, efficient information management, and unparalleled scalability and security. The N3uron platform makes it easier for operations teams to aggregate, manage and analyze industrial data, resulting in enhanced productivity and informed decision-making. Whether you're looking to optimize your operations, reduce downtime or improve product quality, the N3uron platform is the answer.
CONTRIBUTING MEMBER
N3uron is a Contributing Member of the Eclipse Foundation, actively participating in the development of their robust ecosystem. By leveraging EF technologies, we offer innovative products and services that drive our corporate strategy forward. N3uron is Sparkplug Compatible Software.
DLMS® UA MEMBER
N3uron is a member of the DLMS® User Association, the global community that drives standardization in the energy and water industry. Being part of the DLMS UA represents N3uron's commitment to advancing smart metering and energy management solutions.
FOLLOW US
N3uron Connectivity Systems • Paseo de la Castellana, 91, 4º, 1; Madrid, 28046, Spain • +34 911 841 938 • [email protected]