Using SparkplugCmd Utility as Sparkplug Edge Node

From OPC Labs Knowledge Base

For general information about the SparkplugCmd tool, see Category:SparkplugCmd Utility.

Commands, Arguments and Options

The commands described here can be entered at the SparkplugCmd> prompt, or directly on the command-line invoking the SparkplugCmd utility.

Command: edgeNode

Arguments

The command has following arguments:

resourceDescriptor Sparkplug broker descriptor (default mqtt://localhost/)
groupId Group ID (default easyGroup)
edgeNodeId Edge Node ID

Options

The edgeNode command has following specific options:

-ci|--clientId <string> Client ID
-phi|--primaryHostId <string> Primary Host ID
-sv|--sparkplugVersion <sparkplugVersion> Sparkplug version

The clientId options sets the client ID that will be used for the connection to the MQTT broker. When this value is empty (which is the default), the component will generate the client ID automatically, attempting to make it unique in the Sparkplug system.

The primaryHostId option sets the Sparkplug host ID of the Sparkplug primary host application for this edge node. When this value is empty (which is the default), the edge node will not be tied to anyprimary host application, and it will publish data whenever it is connected to the broker. When this value is set to a non-empty string, the edge node will observer the status of the specified primary host application, and will only publish data when the primary host application is online.

With the sparkplugVersion option, you can set a combination of following flags: None|Specification22|Specification30|PayloadA|PayloadB . The flags represent the versions of the Sparkplug specification, payload encoding schemes and their versions.

Command: edgeNode start

This command starts a Sparkplug edge node with pre-defined content (metrics on the edge node itself, and devices with further metrics on them). By default, it connects to "mqtt://localhost" (unauthenticated TCP connection, using port 1883).

Sub-commands

By default, the edge node runs until the you press X on the keyboard. Use the !wait sub-command to specify a finite duration.