Customer Knowledge Base

Niagara PRO TIPS: JSON Toolkit and MQTT (Part 1)

image-20260129-155517.png

JSON Toolkit with MQTT Publishing

Follow‑Along Guide with Time‑Coded Sections
Based on Niagara Pro Tips – JSON Toolkit + MQTT (James Johnson)

Video Tutorial: Niagara PRO TIPS: JSON Toolkit and MQTT (Part 1)

NOTE:
If you want to watch the video while following along with the text notes, then
Right Click & Open The Video in a new split screen window and the video should appear on the right of the notes so that you can follow along.


0:00 Introduction

This training module shows how to use the Niagara JSON Toolkit to build a JSON payload, embed point data using BQL Queries, and publish the result over MQTT using a String Publish Point.

This guide follows the video step-by-step with the same timecodes so you can pause and follow at your own pace.


0:21 Overview and Demo Station Setup

In the example station:

  • The controller is a JACE running a BACnet network

  • Under the BACnet Driver → Floor 1 → several AHU devices

  • The goal is to collect AHU point data and export it as JSON using MQTT

Key components used:

  • JSON Toolkit → JsonSchema

  • Query → BqlQuery

  • Query Embedding → BoundQueryResult

  • MQTT Driver → String Publish Point


1:50 Working on the Wiresheet (JsonSchema Component)

Steps

  1. Drag JsonSchema from the JSON Toolkit palette onto your Wiresheet.

  2. Add basic fields, such as:

    • Station Name

    • Current Time

    • Message ID

These properties demonstrate how the schema updates each time the message is generated.

Example JsonSchema Structure (simple)

{
  "stationName": "{station:name}",
  "timestamp": "{currentTime}",
  "messageId": "{incrementing-id}"
}

Click Generate to verify the message ID and time update each time.


2:53 Creating a JSON Query (BQL)

Timecode: JSON Query

You now create a BQL query to gather AHU point data.

Steps

  1. From JSON Toolkit → Query, drag BqlQuery onto the JsonSchema.

  2. Rename it to something meaningful, for example:

    allAhuData
    
    
  3. Set Query Scope:

    slot:|slot:/Drivers/BacnetNetwork
    
    
  4. Build the BQL query predicate.

Example BQL Predicate

Find all BACnet proxy points whose device name begins with “AHU”:

proxyExt.device.displayName LIKE 'AHU%'

Example Projection Fields

These become JSON columns.

proxyExt.device.displayName AS ahuDisplayName,
displayName AS pointName,
value WITH facets AS value,
status AS status

Test the Query

Click Play next to the ORD field.
Confirm it returns the expected list of ~200+ points (in the video: 285).


4:40 Embedding Query Results in JSON

Timecode: Embedding Results

To embed your query results inside the JSON payload:

Steps

  1. Drag BoundQueryResult from the palette.

  2. Drop it inside the JsonSchema object.

  3. Select your query:

    allAhuData
    
    
  4. Choose an output style:

    • Array (most common)

    • Object

    • Key/Value

  5. Execute the query:

    • Right‑click → Execute All Queries

  6. Click Generate on JsonSchema again.

Example JSON Payload Output

{
  "stationName": "Building1",
  "timestamp": "2026-03-04T10:00:00Z",
  "messageId": 34,
  "ahuData": [
    {
      "ahuDisplayName": "AHU-1",
      "pointName": "SupplyTemp",
      "value": 16.2,
      "status": "ok"
    },
    {
      "ahuDisplayName": "AHU-1",
      "pointName": "FanStatus",
      "value": "Off",
      "status": "ok"
    }
  ]
}


6:41 Exporting JSON Data

Timecode: Exporting Data

You now export the generated JSON string.

Steps

  1. Open the JsonSchema component.

  2. Locate the out (string) slot.

  3. Right‑click → Link Mark.

This prepares the payload for connection into MQTT.


7:02 Publishing via MQTT

Timecode: Publishing Data

Steps to configure MQTT:

  1. Go to Drivers → MQTT Driver.

  2. Add an MQTT Connection

    • In the demo, HiveMQ public broker is used.

    • For production, use secure authentication.

  3. Add a String Publish Point.

  4. Set the topic, for example:

    building1/floor1/ahuData
    
    
  5. Link the in16 slot to the JsonSchema → out slot.


8:02 MQTT Publish Point Behaviour

Timecode: MQTT Proxy Points

Key proxy extension properties:

Publish On Change

  • Default: true

  • The message publishes whenever the string changes.

Retained

  • If true:

    • The broker stores the last message

    • New subscribers receive it immediately

QoS Levels

  • 0: Fire and Forget

  • 1: At Least Once

    • Recommended for JSON payloads

    • Confirms delivery back to the station


9:01 MQTT Example Subscription

Timecode: MQTT Example

Using MQTT Lens or similar client:

  1. Connect to the same broker.

  2. Subscribe to:

    building1/floor1/ahuData
    
    
  3. You will immediately receive the full JSON output.

If retained = true and QoS = 1, clients always get the latest published message.


10:14 Summary

Timecode: Summary

You have now built a complete workflow:

  1. Generate JSON Payload

  2. Run BQL Query to collect AHU data

  3. Embed data into the JSON template

  4. Output the JSON string

  5. Publish via MQTT

  6. Subscribe using an MQTT client to confirm delivery

This approach is suitable for:

  • Whole building exports

  • Device-level summaries

  • Integrating with cloud platforms

  • Data pipelines (HiveMQ, Azure IoT, AWS IoT, Ubidots, Thingsboard)

Future modules will show:

  • Device‑by‑device JSON payloads

  • Using relative JSON schemas

  • More granular publish strategies


Presenter: James Johnson
Series: Niagara PRO TIPS
Topic: Schedule Relations Part 1 – Smart Relations and PX
Part: 1 of 2
Key Concept: Using smart relations to create dynamic, queryable connections between schedules and control points, enabling intelligent navigation and reporting even through complex logic chains

YouTube: http://www.youtube.com/@TridiumInc


Other Resources & Customer Survey:

💬 Don't miss out! Follow the Forest Rock News channel on WhatsApp Click Here!
💬 We’d also love your feedback! Please take a moment to complete our quick Customer Survey
It only takes a minute and helps us serve you better!

image-20260224-141120.png

IoT Devices for BMS, Automation & Smart Connectivity | Forest Rock