Example

This example demonstrates how to use the Action Agent to publish set of sensor readings such as Pressure, Temperature, Humidity and Sound as well as timestamps, sequence and other sensor details to an MQTT broker with Sparkplug B compliant payload. It is designed to work with Sparkplug B Listener Examples.

Refer to configuration to understand all configuration options of this Agent.

Step 1: Add the Agent

  1. Drag the Sparkplug B Action Agent onto the canvas.

  2. Rename the Agent, link the input endpoint to the sensor readings and the output to the printer.

  3. Save the Data Stream.

  4. Double-click to configure the Agent.

Step 2: Configure Broker Connection

Set the Connection details of the Broker

In this case, tick Use Variables and select Spb Broker as Broker Address.

Step 3: Configure Topic

Set the Group ID, Message Type, Edge Node ID and Device ID.

In this case select Spb Group ID, NBIRTH, Spb Edge Node ID and Spb Device ID.

Step 4: Configure Payload

Set the Timestamp, enter the Metrics, and set the Sequence.

In this case, set the timestamp to Timestamp.

Click the plus button next to Metrics, add the Name, Timestamp, Data Type and Value, then click save. Repeat to add the metrics as per the table below:

Set the Sequence to ReadingNo.

Step 5: Results

Apply the changes, save the Data Stream, and publish it. Ensure the Sparkplug B Listener Parse to Columns Example is also published.

Let's look at the Live Data View.

Observe that the sensor readings are printed and the configured payload is published to the MQTT broker.

And the Sparkplug B Listener Example prints the same values.

Files

See the Import, Export, and Clone - XMPro article for steps to import a Data Stream.

Last updated