Configure MQTT SpB broker, publishers, and TagProvider collectors in FrameworX.
Tutorials → Technology Learning Tutorial → MQTT SpB Tutorial
This Tutorial Teaches you to:
- Start the MQTT internal broker
- Start the MQTT SpB Simulator
- Set up publishers using Device channels
- Set up collectors using TagProvider Services
Prerequisites
- Add Tags to UNS (Tutorial)
- Basic understanding of MQTT protocol
- Access to Data Explorer and MQTT tools
Step 1: Set Up the MQTT Broker and Simulator
Start the Built-in Broker
- Navigate to Data Explorer → MQTT Tools
- Click Run Local Built-in Broker to start the broker (default MQTT port 1883)
- Connect to the broker (connection will show as established)
Run the MQTT Publisher Simulator
- Start the MQTT Publisher Simulator
- Verify data is publishing - you'll see:
- Cities (e.g., Barcelona)
- Solar panels with properties:
- Name
- Power
- Temperature
- Real-time changing values
Step 2: Map and Publish Data Using Devices
Create Device Mapping
- Select a panel (e.g., Panel 1) from the simulator
- Click Map to the Solution
- Choose Publisher and New DeviceNode
- Confirm to create tags automatically
Configure Channel Settings
- Go to Devices → Channels
- Confirm all the settings are as expected, including the Group ID from the broker.
Configure Node Settings
- Go to Devices → Nodes
- Confirm all the settings are as expected, including the Node ID from the broker.
Configure Points
- Check Points section for mapped tags (e.g., PAN01)
- Verify the address structure:
- Group ID: cities
- Node ID: Barcelona
- Device ID: Panel_1
SparkplugB Topic Format
Behind the scenes, the Group / Node / Device fields you just configured compose into the canonical SparkplugB topic:
spBv1.0/<Group>/<MessageType>/<EdgeNode>/<Device>
For the sample above this becomes spBv1.0/cities/<MessageType>/Barcelona/Panel_1. MessageType is one of: NBIRTH, DBIRTH, NDATA, DDATA, NDEATH, DDEATH, NCMD, DCMD. FrameworX emits these automatically as the runtime starts up (BIRTH), publishes data (DATA), shuts down (DEATH), and receives commands (CMD). The topic order is namespace / group_id / message_type / edge_node_id / device_id — not namespace / node / group.
Verify: After saving the mapping, open Devices → Points and confirm the new rows appear with the Group/Node/Device columns populated as expected.
MQTT SpB Tag Structure
If you are creating tags manually, instead of mapping directly from the Data Explorer, it is important to note that when using MQTT SpB, all the tags must be in a structure. It means that you need to create a user type and use the root level of the user type in the communication.
Step 3: Collect Data Using TagProvider
Create TagProvider
- Navigate to Frameworks → TagProvider Services
- Click Create New TagProvider
- Select MQTT SparkPlug B Collector Connector
- Change the settings to connect to your broker
- Test the broker connection
Link to Asset Tree
- In Asset Tree, create a folder (e.g., "Barcelona")
- Link the TagProvider to this folder
- Navigate the tree structure to see values
Access Asset Data
- Open Tools → Object Browser
- Navigate to your asset (e.g., Barcelona → Panel1 → Current)
- Copy the asset path using the top button
- Paste this path anywhere in the software to retrieve values
Step 4: Configure Runtime Publishing
Enable Local Tag Publishing
- In Runtime → Startup, before running the solution, check "Publish to MQTT Broker" option (Advanced settings)
- This automatically publishes public local tags to the broker
- Verify: After enabling, the runtime will publish public local tags on the same broker connection — you can confirm in Step 5 using Object Browser.
Create Local Tags (Optional)
- Go to Unified Namespace > Tags
- Create a new local tag (e.g., "LocalTagPower")
- Set visibility column to Public for read/write access
- Public: Read and write access
- Protected: Read-only access
- Private: Tag not visible
Step 5: Run and Monitor the Solution
Start Runtime
- In Runtime → Startup, click Run Startup
- Verify all connections are active
Monitor Data Flow
- Use Diagnostic Tools → Property Watch to monitor tag values
- Use Object Browser to:
- Navigate to specific tags (e.g., Barcelona → Panel1 → Current)
- Copy tag paths
- Add tags to watch lists for testing
Verify Data Collection
- Check that asset values are updating in real-time
- Confirm data is flowing from:
- Simulator → Broker
- Broker → Device mappings
- TagProvider → Asset tree
In this section...