Prerequisites:
- Knowledge of Ignition and Module installation process: Cirrus Link Module Installation
- Install the following MQTT Modules
- MQTT Distributor
- v5.0.X if using Ignition 8.3.x
- MQTT Transmission
- v5.0.X if using Ignition 8.3.x
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.
MQTT Message Publishing via Ignition Script:
Start by opening an Ignition Designer window and right click 'Scripting → Gateway Event Scripts → Tag Change' to select 'New Tag Change Script' from the Project Browser as shown below:

Enter the name 'Publish Script' and click 'Create Tag Change' - You will see this view:

After setting the name of the script, select a tag path. In this case we're using a tag in the default tag provider called 'MyTriggerTag' as shown below.

In the Script panel, 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:
- serverName: The server name as shown in the MQTT Transmission Settings configuration shown below
- mqttTopic: The MQTT Topic to publish on
- payload: The MQTT payload
- qos: The MQTT quality of service to publish on
- retain: Whether or not to set the retain flag in the MQTT message
When complete, the script should look something like this.

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'.
Logging Errors
If you have not enabled the RPC Client under Sets RPC Client and attempt to perform the system.cirruslink.transmission.publish call, the logs will show:

If the RPC Client is enabled under Sets RPC Client but is misconfigured under Server RPC Client Connection, the logs will show errors similar to the one below:

Additional Resources
- Inductive Automation's Ignition download with free trial
- Azure Injector download with free trial
- Questions about this tutorial?
- Sales questions
- About Cirrus Link