Versions Compared

Key

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

...

Warning
titleDRAFT v0.1

This skill has open items that require resolution before publishing. See the Open Items section at the bottom of this page.

...

Section


Column
width50%

What This Skill Does

This skill connects FrameworX to an external MQTT broker using a TagProvider — the dynamic, zero-local-tags approach. Instead of creating individual UnsTags and mapping them with Device Points, the TagProvider auto-discovers the broker's topic tree and extends the UNS namespace directly. The skill then builds a complete asset-navigation UI: a Layout with an AssetTree on the left, a header with commands, and a content area that reacts to the user's tree selection using Asset() bindings and Client.Context properties.

Code Block
languagetext
titleArchitecture
MQTT Broker ??? TagProvider ??? UNS Namespace (dynamic)
                                    ?
                              AssetTree Folder
                                    ?
                    ?????????????????????????????????
                  Header        AssetTree         MainPage
                 (Canvas)    (Navigation)     (DataGrid + Trend)
                                    ?
                          Client.Context.AssetPath
                          drives all content dynamically



Column
width50%

On this page:

Table of Contents
maxLevel2
minLevel2
indent10px
stylenone


When to Use This Skill

Use this skill when:

  • The user wants to connect to an external MQTT broker (not create local simulated data)
  • The data structure is dynamic or unknown upfront — the broker defines what exists
  • The user mentions TagProvider, MQTT, IIoT, UNS integration, or auto-discovery
  • The user wants an asset-navigation UI where selecting a tree node changes the displayed data
  • The application is monitoring/visualization focused (not tight SCADA control)

...

Scenario

Approach

Dynamic data, auto-discovery wanted

This skill (TagProvider)

Specific tags, strict validation (FDA)

Device Module

Large topic tree, monitoring/IoT

This skill (TagProvider)

Small fixed set of MQTT topics

Device Module may be simpler

Prerequisites

  • Solution must be open (open_solution or create_solution completed)
  • An MQTT broker must be accessible from the machine (local or remote)
  • For testing without an external broker: FrameworX has a built-in MQTT broker and a SparkplugB simulator that can be started from Data Explorer → MQTT Tools

MCP Tools and Tables Involved

Category

Items

Tools

designer_action, get_designer_state, get_table_schema, write_objects, list_protocols, list_elements, get_screenshot

Tables

UnsTagProviders, UnsAssetTree, DisplaysList, DisplaysLayouts

Designer Actions

navigate (to DataExplorer.MQTTTools), connect_mqtt_explorer (new), start_mqtt_broker, start_mqtt_simulator

Key Namespaces

Client.Context.AssetPath, Client.Context.AssetName, Client.Context.AssetNodeName, Client.Context.SelectedTag

Implementation Steps

Step 0: Discover the MQTT Broker Data (Interactive)

Before creating any configuration, you need to see what data the broker has. This step is interactive — it involves the user.

...

Tip

AI-driven alternative: If the user says "just connect everything" or "pick reasonable defaults," the AI can read the top-level structure from get_designer_state() and propose a reasonable default selection, then create the configuration. Verify with the user afterward — it's easier to modify an existing object than to wait for the user to manually select before creating anything.

Step 1: Create the TagProvider Connection

Fetch the schema and protocol details:

...

After creation, the TagProvider immediately starts discovering topics when runtime starts. Topics appear as dynamic tags under Tag.<ProviderName>.<topic.path>.

Step 2: Create the Linked Folder in AssetTree

The AssetTree folder is what makes the TagProvider data visible and navigable in the UI. A Linked Folder connects an AssetTree node to a TagProvider and specifies which initial nodes from the provider's namespace to display.

...

From this point down, the AssetTree is dynamic — the platform auto-expands the tree based on whatever the MQTT broker publishes. No further tag creation needed.

Step 3: Build the Layout (Header + AssetTree + Content)

The standard pattern for asset-navigation applications is a Layout with three regions:

...

  • Header: Top bar — title, navigation buttons, status indicators
  • Menu (left side): The AssetTree control — users click here to navigate assets
  • Content (main area): The display that reacts to the selected asset

Step 4: Create the Header Display

A simple Canvas display with the application title:

...

Code Block
languagejson
titlewrite_objects — Header display
{
  "table_type": "DisplaysList",
  "data": [
    {
      "Name": "Header",
      "PanelType": "Canvas",
      "Width": 1200,
      "Height": 60,
      "Description": "Application header bar",
      "Objects": [
        {
          "Type": "TextBlock",
          "Name": "Title",
          "Left": 20,
          "Top": 15,
          "Text": "MQTT Production Monitor",
          "FontSize": 18,
          "FontWeight": "Bold"
        }
      ]
    }
  ]
}

Step 5: Create the AssetTree Menu Display

A Canvas display containing the AssetTree control that drives navigation:

...

These properties drive the content display reactively.

Step 6: Create the MainPage (Dynamic Content)

The MainPage uses Asset() bindings to react to the user's tree selection. All content is driven by Client.Context.AssetPath.

...

Code Block
languagecsharp
titleAsset() usage patterns
// In scripts or CodeBehind:
double value = Asset(@Client.Context.AssetPath + "/Temperature");

// In display element LinkedValue fields:
// Static: @Tag.MQTT.plant.line1.temperature
// Dynamic: Asset(Client.Context.AssetPath + "/Temperature")

Step 7: Start Runtime and Verify

Code Block
languagetext
designer_action('start_runtime')

...

Code Block
languagetext
get_screenshot('runtime')

Code Examples

Asset() in CodeBehind (Display Events)

Code Block
languagecsharp
titleOpening event — set initial context
void Opening()
{
    // Optionally set a default branch to expand
    @Client.Context.TreeInitialBranch = "MQTT/spBv1.0/GroupID";
}

Asset() in Scripts

Code Block
languagecsharp
titleRead dynamic value based on context
public static double GetTemperature(string assetPath)
{
    return TK.ToDouble(Asset(assetPath + "/Temperature"));
}

Data Type Handling for HTML5/Portable Clients

Code Block
languagecsharp
titleType conversion — WPF vs HTML5
// WPF (.NET Framework 4.8) — automatic type resolution
var value = Asset("/MQTT/plant/line1/temperature");

// HTML5/Portable (NetStandard 2.0) — explicit conversion required
int intValue = TK.ToInt(Asset("/MQTT/plant/line1/count"));
double dblValue = TK.ToDouble(Asset("/MQTT/plant/line1/temperature"));
string strValue = TK.ToString(Asset("/MQTT/plant/line1/status"));
bool boolValue = TK.ToDigital(Asset("/MQTT/plant/line1/running"));

Verification

  1. get_objects('UnsTagProviders') — verify the TagProvider was created with correct PrimaryStation
  2. designer_action('navigate', 'Uns.AssetTree')get_designer_state() — confirm the linked folder appears with the TagProvider reference
  3. designer_action('start_runtime')get_runtime_state() — confirm the TagProvider connection is active
  4. get_screenshot('runtime') — verify the AssetTree populates and the Layout renders correctly
  5. Ask the user to click different nodes in the AssetTree and confirm the DataGrid updates dynamically

Common Pitfalls

Mistake

Why It Happens

How to Avoid

Creating local UnsTags for MQTT data

Habit from Device Module workflow

TagProviders don't need local tags — that's the whole point. Only create UnsTags if you need alarms or historian on specific points.

Wrong PrimaryStation format

Forgetting semicolon delimiters or field order

Always call list_protocols('mqtt') first. The format is 14 semicolon-separated fields.

DataGrid shows nothing

LinkedValue not correctly bound to context

Use @Tag with LinkedContext set to @Client.Context.AssetPath. The DataGrid needs both.

Topics with special chars not accessible

MQTT topics like spBv1.0/Group contain dots

Use quoted syntax: Tag.ProviderName.("spBv1.0/Group/Node")

AssetTree empty after runtime start

TagProvider not connected or linked folder not configured

Verify TagProvider connection in ServicesMonitor, then check that UnsAssetTree folder has correct TagProviderLink

Trying to set alarms on dynamic tags

Dynamic tags don't exist as local UnsTags

Create a local tag and use a Script expression to copy the Asset() value into it. Or switch those specific points to Device Module.

Layout regions not rendering

Wrong display names in Layout configuration

Display names in Header, Menu, Content fields must match exactly (case-insensitive)

Variations

Variation A: Mixed Approach (TagProvider + Device Module)

...

  • For specific TagProvider paths that need historical trending, create a Historian TagProvider connection
  • TrendCharts can use Asset() syntax to automatically query historical data from historian TagProviders
  • Useful when you need long-term trending on external data without creating local tags

Related Skills

  • skill-device-mqtt — Explicit MQTT integration using Device Module (Channel → Node → Points)
  • skill-asset-navigation — Generic asset-navigation UI patterns (not MQTT-specific)
  • skill-sparkplugb-collector — SparkplugB Collector setup with Device Module

Documentation References

Open Items (Draft Notes)

Status
colourRed
titleDRAFT

#

Item

Status

1

connect_mqtt_explorer designer_action: New action needed — navigates to DataExplorer.MQTTTools and initiates connection with a PrimaryStation string. Not yet implemented.

Status
colourRed
titleTODO

2

get_designer_state() for MQTT Tools: Must return the user's selected nodes in the MQTT browser tree. This is how the AI reads which nodes the user wants to integrate.

Status
colourRed
titleTODO

3

UnsAssetTree write support: Currently readOnly: true. Need writable schema with fields: Name, TagProviderLink, InitialPath, Description. Exact field names TBD.

Status
colourRed
titleTODO

4

DataGrid LinkedContext property: Verify exact property name and behavior — does DataGrid have LinkedContext as a separate field, or is asset-driven behavior configured differently?

Status
colourYellow
titleVERIFY

5

TrendChart Asset() binding: How does a TrendChart dynamically bind its pens to the currently selected asset's children?

Status
colourYellow
titleVERIFY

6

Layout field names: Verify exact field names for DisplaysLayouts — is it Header, Menu, Content or different property names?

Status
colourYellow
titleVERIFY

7

Template integration: If solution templates with built-in Header+AssetTree+Content exist, reference them as a shortcut.

Status
colourYellow
titleVERIFY

...

In this section...

Page Tree
root@parent

...