Versions Compared

Key

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

...

The MQTT Modules publish data in a JSON format with each message comprising a Topic and Payload.

The Topic contains the following key/value pairs:

  • namespace
    • Set as "spBv1.0"
  • edgeNodeDescriptor
    • The combination of the Group ID and Edge Node ID which provides a unique identifier for the Edge Node
  • groupId
    • The Group ID
  • edgeNodeId
    • The Edge Node ID
  • deviceId
    • The Device ID
  • type


Note
The deviceId is only included for the device level message types of DBIRTH, DDATA and DDEATH

Image Removed

...

The Edge Node BIRTH message will contain a Topic and Payload:

...

  • Namespace
  • Edge Node Descriptor
  • Group ID
  • Edge Node ID
  • Message Type

...


The Payload contains the following key/value pairs:

  • timestamp
    • The time stamp that the payload was created
  • metrics
    • An array containing data specific to the message type being published
    • Each object in the array will include the following name/value pairs:
      • name
      • timestamp
      • dataType
      • value
    • Optional name/value pairs include:
      • metaData
        • Meta Data property values, including Tooltip and Documentation, are included if they have been changed from the Ignition default. See the Ignition Tag Properties reference for all available properties.
      • properties
        • The Quality property. See the Ignition Tag Quality Code Reference for the Data Quality value reference.
          • If the Quality property is not included, the quality of the tag data is considered Good.
        • Additional property values such as engHigh, engLow etc are included if they have been changed from the Ignition default or if they are custom properties. See the Ignition Tag Properties reference for all available properties.
  • seq
    • The message sequence number used to ensure that messages are processed in the correct order


Note
metaData and property values, other that Quality, are only included in the NBIRTH or DBIRTH messages and only if they have changed from the Ignition default.

Sample JSON messages

Using a simple tag tree structure shown below, we can show how these JSON formatted messages will be generated:

Image Added

Anchor
NBIRTH
NBIRTH
NBIRTH

The metrics array for the Edge Node BIRTH message will contain:

  • A Birth/Death sequence number to track the Sparkplug session of the Edge client
  • Any Edge Node tags defined in the Edge Node folder
  • Seq - the message sequence number


Code Block
titleEdge Node Birth BIRTH message
{
  "topic": {
    "namespace": "spBv1.0",
	"edgeNodeDescriptor": "G1/E1",
    "groupId": "G1",
    "edgeNodeId": "E1",
	"type": "NBIRTH"
  },
  "payload": {
    "timestamp": 1638223073190,
    "metrics": [
      {
        "name": "bdSeq",
        "timestamp": 1638223073187,
        "dataType": "Int64",
        "value": 5
      },
	  {
        "name": "Tag 4",
        "timestamp": 1638223073156,
        "dataType": "Int32",
        "metaData": {}
    ,
        "properties": {
             "Quality": {
                 "type": "Int32",
                 "value": 192
			 }
        },
        "value": 100
      },       
	  {
        "name": "Tag 5",
        "timestamp": 1638223073001,
        "dataType": "Boolean",
        "metaData": {},
        "properties": {
             "Quality": {
                 "type": "Int32",
                 "value": 192
             }
        },
        "value": false
      }
     ],
    "seq": 0
  }
}


Anchor
DBIRTH
DBIRTH
DBIRTH

The metrics array for the Device BIRTH message will contain the following:

  • The Sparkplug elements: Namespace, Group ID, Edge Node ID, Device ID.  They will be grouped under "topic" along with Message Type
  • A "timestamp" for when the payload was constructed
  • Any Device tags defined in the Device folder
  • A message sequence number


Code Block
titleDevice BIRTH message
{
  "topic": {
            "namespace": "spBv1.0",
            "edgeNodeDescriptor": "G1/E1",
            "groupId": "G1",
            "edgeNodeId": "E1",
            "deviceId": "D1",
            "type": "DBIRTH"
    },
    "payload": {
        "timestamp": 1638223073192,
        "metrics": [
              {
                    "name": "T1Tag 1",
                    "timestamp": 1638223073192,
            "dataType": "Int32",
                    "dataType": "Int32",
        "metaData": {},
        "properties": {
            "Quality": {
                "type": "Int32",
                "value": 192
            }
        },
        "value": 1
      },
      {
        "name": "Tag 2",
        "timestamp": 1638223073011,
        "dataType": "Boolean",
        "metaData": {},
        "properties": {
             "Quality": {
                 "type": "Int32",
                 "value": 192
             }
        },
        "value": false
      },
      {
        "name": "Tag 3",
        "timestamp": 1638223073041,
        "dataType": "Float",
        "metaData": {},
                    "properties": {
                             "Quality": {
                                     "type": "Int32",
                                     "value": 192
                }
            },
                         }
        },
        "value": 12
        }
    1.23
      }
     ],
        "seq": 1
   }
}


Anchor

...

NDATA

...

NDATA

...

NDATA

The Device DDATA metrics array for the Edge Node NDATA message will contain the following:

  • The Sparkplug elements: Namespace, Group ID, Edge Node ID, Device ID.  They will be grouped under "topic" along with Message Type
  • A "timestamp" for when the payload was constructed
  • Any Device tags defined in the "Device folder that have changed
  • A message sequence number

  • Any tags defined in the Edge Node folder that have changed, For example if we write the value 10 to Tag 4


Code Block
titleEdge Node DATA message
{
  "topic": {
    "namespace": "spBv1.0",
    "edgeNodeDescriptor": "G1/E1",
    "groupId": "G1",
    "edgeNodeId": "E1",
    "type": "NDATA"
  },
  "payload": {
    "timestamp": 1638223663812,
    "metrics": [
      {
        "name": "Tag 4",
        "timestamp": 1638223662800,
        "dataType": "Int32",
        "value": 10
      }
    ],
    "seq": 2
  }
}


Anchor
DDATA
DDATA
DDATA

The metrics array for the Device DDATA message will contain: 

  • Any tags defined in the Device folder that have changed, For example if we write the value 10 to Tag 1


Code Block
titleDevice DATA message
{
  "topic": {
    "namespace": "spBv1.0",
	"edgeNodeDescriptor": "G1/E1",
    "groupId": "G1",
    "edgeNodeId": "E1",
    "deviceId": "D1",
	"type": "DDATA"
  },
  "payload": {
    "timestamp": 1638223663812,
    "metrics": [
      {
        "name": "T1Tag 1",
        "timestamp": 1638223662800,
        "dataType": "INT32Int32",
        "value": 10010
      }
    ],
    "seq": 23
  }
}


Anchor
NDEATH
NDEATH
NDEATH

The metrics array for the Edge Node DEATH message will contain:

  • A Birth/Death sequence number to track the Sparkplug session of the Edge client


Code Block
titleEdge Node DEATH message
{
  "topic": {
    "namespace": "spBv1.0",
    "edgeNodeDescriptor": "G1/E1",
    "groupId": "G1",
    "edgeNodeId": "E1",
    "type": "NDEATH"
  },
  "payload": {
    "timestamp": 1638223073190,
    "metrics": [
      {
        "name": "bdSeq",
        "timestamp": 1638223073187,
        "dataType": "Int64",
        "value": 5
      }      
     ]
  }
}


Anchor
DDEATH
DDEATH
DDEATH

The metrics array for the DDEATH message will be empty.


Code Block
titleDevice DEATH message
{
  "topic": {
      "namespace": "spBv1.0",
      "edgeNodeDescriptor": "G1/E1",
      "groupId": "G1",
      "edgeNodeId": "E1",
      "deviceId": "D1",
      "type": "DDEATH"
  },
  "payload": {
    "timestamp": 1638223073192,
    "metrics": []
  }
}




Excerpt Include
CLD80:FAQ: Ignition Modules
CLD80:FAQ: Ignition Modules
nopaneltrue
Understanding and decoding Ignition QualityCodes