VQT messages

Currently there are two versions of the MQTT message formats that are supported in APIS.

VQT Version 1

Version 1 for MQTT messages is a simple JSON object that contains the following keys:

  • Message type
  • Message version
  • Value
  • Quality
  • Timestamp

All the values defined in a VQT1 message will have the same timestamp. If timestamp is not defined, the values will be associated with the current time on the system.

VQT1 Example


	{

		"messagetype": "vqt", 
		"version": 1, 
		"t": "2022-09-22T06:06:28.891+00:00", 
		"Tag1": 43, 
		"Tag2": 58,
		"Tag3": 80,
		"q": 0

	}

User can define the text strings for the time,value and quality of an item. The text strings for Time id, Value id and Quality id in a message must match the Time id, Value id and Quality id for the value items in the property editor. Note: Timezone information needs to be provided in the timsestamps.

For the above example message, the properties for a value items in APIS should be set as follows:

Value itemValue idTime idQuality id
Tag 1Tag1tq
Tag 2Tag2tq
Tag 3Tag3tq

Mandatory Fields in message:

  • messagetype
  • version
  • value id string

Quality Codes

The quality codes for the value items in VQT 1 messages are as follows:

QualityCodes
Good0
BadAnything other than 0

VQT Version 2

Version 2 for MQTT messages is a simple JSON object that contains the following keys:

  • Message type
  • Message version
  • Quality
  • Timestamp
  • Payload

Payload is the content of the message. It is an array/list of JSON objects for value items and has the following attributes:

  • k (Key)
  • v (Value id)
  • t (Time id)
  • q (Quality id)

All these attributes for value items shall be represented as key:value pairs in the payload.

Timestamp can be defined for the entire message or inside the payload object for every item separately.
With VQT2, it is also possible to have multiple timestamped values associated with a value item in a message i.e there can be multiple JSON objects for a single value item by including multiple timestamps inside the payload.
If timestamp is not defined, the values will be associated with the current time on the system.

VQT2 Example


	{
		"messagetype": "vqt",
		"version": 2,
		"payload": 
			[
				{
					"k": "Tag1",
					"v": 10,
					"t": "2022-09-22T06:06:32.913554+00:00",
					"q": 192
				},

				{
					"k": "Tag1",
					"v": 3,
					"t": "2022-09-23T05:56:36.930429+00:00",
					"q": 192
				},

				{
					"k": "Tag2",
					"v": 70,
					"q": 192
				},

				{
					"k": "Tag3",
					"v": 98,
				}
			]
	} 

The text strings for value id, time id and quality id are fixed in this version to "v", "q" and "t" respectively and must be defined accordingly in the message.

For the above example message, the properties for a value items in APIS should be set as follows:

Value itemKey
Tag 1Tag1
Tag 2Tag2
Tag 3Tag3

Mandatory Fields in message:

  • messagetype
  • version
  • payload
  • k (key)
  • v (value)

Quality Codes

The quality codes for the value items in VQT 2 messages are as follows:

QualityCodes
Good192
Local override216
Bad0
Config error4
Not connected8
Device failure12
Sensor failure16
Last known20
Comm failure24
Out of service28
Waiting for initial data32
Uncertain64
Last usable68
Sensor cal80
EGU exceeded84
Sub normal88