Contents
Cirrus Link Resources
Cirrus Link Website
Contact Us (Sales/Support)
Forum
Cirrus Link Modules Docs for Ignition 7.9.x
Inductive Resources
Ignition User Manual
Knowledge Base Articles
Inductive University
Forum
MQTT Engine Custom Namespaces, configured to parse the payload as JSON, do not handle changing JSON structures automatically due to the way JSON payloads are parsed.
Consider these two examples of changing payloads on the same topic:
(1) Two message payloads received sequential sequentially on topic "a/b" at MQTT Engine where payload 2 has a modified element from message 1:
Code Block | ||
---|---|---|
| ||
{ "level": "value1" } |
Code Block | ||
---|---|---|
| ||
{
"level": {
"key": "value2"
}
} |
...
Now, when the second payload arrives on the same topic, since MQTT Engine does not automatically delete tags, it will try to create the tag "[MQTT Engine]a/b/level/key" with a value of 'value2'. However, level at this point is a leaf tag, not a folder. So, the new leaf tag called 'key' can not be created.
(2) Two message payloads received sequentially on topic "a/b" at MQTT Engine where message 2 is a subset of message 1:
Code Block | ||
---|---|---|
| ||
{
"level": "low"
"temp": "45.0"
"alarm": "on"
} |
At this point, MQTT Engine will create multiple tags with the tagpaths of:
Code Block | ||
---|---|---|
| ||
{
"level": "high"
"temp": "99.0"
} |
On the arrival of the second message, the two leaf tags 'level' and 'temp' will be updated so all tags will now look as follows:
When the second payload arrives on the same topic, since MQTT Engine does not automatically delete tags, it will not modify the tag "[MQTT Engine]a/b/alarm". It will remain as 'good' quality as well.
Tip |
---|
Our recommendation to manage MQTT messages published with the same topic and changing payload JSON structures, is not to use the built in JSON parsing option in the Custom Namespace but to leave parsing as a string, create a tag change script and parse teh the string in a custom script per your requirements. |
...