Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Connect to a MQTT broker and map points.

TutorialsDevices| Tutorial | How-to Guide | Reference


This Tutorial Teaches

(Tutorial) teaches

how to:

  • Configure MQTT client
  • Subscribe to topics
  • Publish tag values using Sparkplug B
  • Map topics to tags

Prerequisites:

To Do:

  • Split this example on Collector and Publisher
  • Use MQTT Explorer

In this page:

Table of Contents
maxLevel2
minLevel2
indent10px
exclude

Steps

Tutorial
stylenone


1. Set Up the MQTT Broker and Simulator

Start the Built-in Broker

  1. Navigate to Data Explorer → MQTT Tools
  2. Click Run Local Built-in Broker to start the broker
  3. Connect to the broker (connection will show as established)

Run the MQTT Publisher Simulator

  1. Start the MQTT Publisher Simulator
  2. Verify data is publishing - you'll see:
    • Cities (e.g., Barcelona)
    • Solar panels with properties:
      • Name
      • Power
      • Temperature
      • Real-time changing values

2.

    Devices →  Tutorial | Concept | How-to Guide | Reference

Configure MQTT Client

  1. Navigate to Devices → Protocols
  2. Select MQTT ClientMessage Queuing Telemetry Transport 
  3. Create channel:
    • Name: MQTTClient
    • Protocol: MQTT Client
    • Settings:
      • Broker URL: test.mosquitto.org (or your broker)
      • Port: 1883 (or 8883 for SSL)
      • Client ID: FrameworX_001
      • Keep Alive: 60 seconds

Set Authentication (if required)

For secured brokers:

  • Username: Your username
  • Password: Your password
  • SSL/TLS: Enable if using port 8883
  • Certificates: Browse to certificate files
  • Subscribe to Topics

    1. Go to Devices Device → Nodes
        Create subscription node:
        1. Name: IoT_Sensors
      1. Channel: MQTTClient
      2. Subscribe Topic: sensors/+/temperature
      3. QoS: 1

      The '+' wildcard subscribes to all sensors.

      1. Open PrimaryStation and configure:
        1. BrokerURL: 127.0.0.1
        2. Port: 502
        3. ClientID: FrameworX



      3. Create Points

      Create Points for Subscribed Data

      1. Navigate to Devices → Points
      2. Add points for each expected topic:

      Temperature Tank 1 Sensor:

      • Name: Sensor1_TagName: TankFarm/Tank1/Temp
      • Node: IoT_Sensors
      • Topic: sensorsTankFarm/sensor1Tank1/temperature
      • Data TypeAccessType: Double
      • JSON Path: $.value (if JSON payload)
      • Read

      Temperature Tank 2 Humidity Sensor:

      • Name: Sensor1_Humidity TankFarm/Tank2/Temp
      • Node: IoT_Sensors
      • Topic: sensorsTankFarm/sensor1Tank2/humiditytemperatureData Type
      • AccessType:
      • Double

      Publish Tag Values

      1. Create publish Device Channel and Node:
        • Protocol: MQTT Publisher 
        • Name: SCADA_Publisher
        • Publish Mode: On Change
      2. Configure published points:
        • Tag: Select tag to publish
        • Topic: scada/line1/production
        • QoS: 1
        • Retain: True (optional)
      • Read

      Temperature Tank 3 Sensor (write):

      • Name: TankFarm/Tank3/Temp
      • Node: IoT_Sensors
      • Topic: TankFarm/Tank3/temperature
      • AccessType: Write



      4. Test Connection

      1. Start Runtime
      2. Open Devices → Devices Monitor
      3. Use MQTT client tool (like MQTT Explorer) to:
        • Publish test messages
        • Verify FrameworX publishes

      Next Steps

    2. CONNECT (Reference) - Explore list of connectors
    3. [Enrich Data & Scripts] - Process MQTT data
    4. [Secure & Deploy] - Production security

    In this section...

    Page Tree
    root@parent
    spaces93DRAF