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
Prerequisites:
Overview:
MQTT Transmission 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 Transmission must have an RPC client enabled and connected to a broker/server to use the publish mechanism
Prior to release 4.0.18 , configuration for the RPC Client was under the Server Advanced
For release 4.0.18 to 4.0.22, configuration for the RPC Client was under the Server RPC Client Connection
For release 4.0.23 and newer, configuration for the RPC Client is under Server RPC Client Connection and Sets RPC Client
MQTT Message Publishing via Ignition Script:
Start by opening an Ignition Designer window and double clicking 'Scripting-> Gateway Event Scripts' from the Project Browser as shown below:
Now select 'Tag Change' click the '+' icon at the bottom of the window shown below and create a new Tag Change Script called 'Publish Script'.
After setting the name of the script and then select a tag path. In this case we're using a tag in the default tag provider called 'MyTriggerTag' as shown below.
Now select the 'Script' tab near the top. In it, type the following line:
system.cirruslink.transmission.publish("Chariot SCADA", "a/b/c", str("hello world").encode(), 0, 0)
Note, the form of the publish method is as follows. You may need to change the method arguments based on your configuration:
system.cirruslink.transmission.publish(String serverName, String mqttTopic, byte[] payload, int qos, boolean retain)
Where:
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'.
Prior to release 4.0.22, MQTT Transmission has a max inflight message limit of 10. Depending on the frequency of MQTT publishes and the QOS selected, you may see the error "Too many publishes in progress" in the Ignition logs.
There are a couple of options to work around this now:
The max inflight message for release 4.0.22 and newer is 500