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 provides a mechanism for publishing MQTT Messages from an Ignition script. This can be useful for general messaging outside of Sparkplug. For example, one may want to interface to another system that uses MQTT. This method allows arbitrary MQTT messages to be published based on events that exist in Ignition.
Note |
---|
MQTT Engine must have a client connection to a broker to use the publish mechanism. This is configured here |
MQTT Message Publishing via Ignition Script:
...
Note |
---|
If your payload contains escape characters such as backslash you will need to use the 'r' modifier on your payload string to ensure these are included. Example JSON payload: payload = r{"metadata" : {"requiredState" : {"value_control" :"{\"pump_1\":{\"2\":\"off\",\"1\":\"off\"},},},}}"},"return" : {}}} |
When complete, the script should look something like this. Now click OK.
...
Finally, save and publish the project. At this point every time this tags value, quality, or timestamp changes it will result in a MQTT message being published on topic 'a/b/c' with a payload of 'hello world'.
Additional JSON examples:
payload=str('{"name":"John", "age":30, "car":"BMW"}').encode()
payload='{"myTestTag":"' + str(system.tag.read("[default]myTestTag").value) + '"}'