SparkplugB Hint Filter Plugin

The sparkplugb-hint filter plugin is designed to add hints for the Sparkplug north plugin. The plugin allows users to configure specific hints for each asset (or set of assets when using regex), ensuring that the necessary information (e.g., Group, EdgeNode, MessageType, Device) is attached to the data. The primary purpose of this filter is to control the namespace used for publishing the data.

To use the SparkplugB Hint plugin, follow these steps:

Configuration of SparkplugB Hint Plugin:

sparkplugb_hint_1

Click on Basic .
  • Enabled: A switch that can be used to enable or disable execution of the filter.

Click on Hints.

sparkplugb_hint_2

  • Key: Define the asset name for which the SparkplugB hint should be applied. The key acts as an identifier for the specific hint and ensures that the metadata is correctly associated with the respective asset. The asset name can also be specified as a regular expression, allowing the plugin to match multiple assets dynamically. For example, using a pattern like Temperature.* can apply the hint to all assets whose names start with “Temperature”.

  • Group: Define the group name for the SparkplugB hint. This should be a valid alphanumeric string without special characters such as /, +, or #. The group represents a logical grouping of devices or sensors within the Sparkplug ecosystem.

  • EdgeNode: Specify the Edge Node name. This represents the device or system acting as the gateway or intermediary for the sensors. Similar to the group, it must not contain special characters.

  • MessageType: Select the type of message being sent (e.g., NDATA or DDATA).

  • Device: Define the device name. This represents the specific endpoint generating the data. It must also adhere to the validation rules for alphanumeric strings.

Click on Save to save and apply the configuration. This configuration ensures that the SparkplugB Hint plugin control the namespace used for publishing the data.

Macro Substitution: The SparkplugB Hint plugin supports macro substitution to dynamically replace placeholders in the hint values with corresponding datapoint values from the readings. Users can include placeholders in the hint fields, such as $plant$, $area$, or $device$, which get substituted with the actual values from the datapoint at runtime.

For example:

  • If the hint for the Group is configured as $plant$, and the datapoint contains a value Plant1 for the plant key, the hint will dynamically resolve to Plant1.

  • Similarly, placeholders like $device$ in the Device hint will be replaced by the actual device name from the data point.

  • $ASSET$ macro is substituted by the asset name

This feature allows for flexible and dynamic hint configurations without hardcoding the values

Application of SparkplugB Hints: The SparkplugB Hint plugin works in conjunction with the Sparkplug north plugin. The hints added by the filter are processed by the Sparkplug north plugin to properly format and publish data according to SparkplugB specifications. This process includes:

  • Establishing the hierarchical namespace for the data using the Group, EdgeNode, and Device fields.

  • Structuring the message type using the MessageType field to distinguish between NDATA and DDATA.

  • Using the Asset Name (Key) to dynamically match and associate hints with specific assets or patterns of assets, leveraging regular expressions for flexible configurations

Example Use Case: Consider a temperature sensor (Device1) connected to an edge node (EdgeNode1) that belongs to a logical group (Group1). When the SparkplugB Hint plugin is applied:

  • The plugin appends a SparkplugB hint to the sensor data, specifying:
    • Group: Group1

    • EdgeNode: EdgeNode1

    • MessageType: NDATA

    • Device: Device1

  • This metadata ensures the data can be processed and interpreted correctly by a Sparkplug north plugin.