Versions Compared

Key

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

One common question is how to use the MQTT message's payload timestamp property rather than the time that the message arrives on the broker or received by Ignition.  

There are two approaches here: parsing as JSON or parsing as a STRING.

Parsing as JSON

Including the timestamp key value/pair in the JSON will result in a tag created at MQTT Engine.

Let say we have a publish received on the topic "test/data/json" with a JSON payload '{ "folderTag" : { "intTag" : 1, "boolTag" : true, "ts" : "2023-07-11T13:10:33.629078" } }'.

MQTT Engine will create a three folders "test", "data" and "json" followed by a tag/folder structure representing the JSON value of the payload:

Image Removed

Parsing as STRING

Our recommended approach is to set MQTT Engine to parse the payload as a STRING and then use the Ignition scripting capabilities to parse out the required elements of the text string and write a Fully Qualified Value to a tag in a non managed tag provider.

Let say we have a publish received on the topic "test/data/point" with a payload "28;2023-07-11;16:09:33".  

MQTT Engine will create a two folders "test" and "data" and a tag "point" with the value of "28;2023-07-11;16:09:33".


We Now we can then use an Ignition Tag Change Event Script on the tag to parse out the required elements of the text string and write a Fully Qualified Value to a tag in a non managed tag provider.

...