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
...
This tutorial shows how to configure the MQTT modules to manually publish and process files.
...
files using both the manual and auto publish methods.
Table of Contents | ||
---|---|---|
|
Install the three MQTT modules listed in the pre-requisites onto your Ignition system following the Cirrus Link Module Installation guide.
...
This allows the three modules to automatically connect and provide a starting base for the tutorial.
...
Warning |
---|
Primary Host ID must be configured for File Transfer to work |
Navigate to the MQTT Engine > Settings in the left side of the Ignition Gateway UI and select the General tab.
...
Edit the Default Set and add a Primary Host ID as shown below:
...
Now we can configure the MQTT Engine module to process the published files.
...
When complete, it should look similar to the following. Save the changes after confirming.
...
Anchor | ||||
---|---|---|---|---|
|
Now we can configure the MQTT Transmission module to publish files using a configured Transmitter. Navigate to the MQTT Transmission > Settings in the left side bar of the Ignition Gateway UI and select the Transmitters tab.
Make note of the Sparkplug IDs configured for your transmitter. For our example we have the Group ID as My MQTT Group and the Edge Node ID as Edge Node faec7e
Note |
---|
If you have an existing Transmitter configured where the Sparkplug IDs are created dynamically from the Ignition tag path, see MQTT Transmission Transmitters and Tag Trees, you will need to identify the Edge Node Descriptor being used and include the GROUP_ID and EDGE_NODE_ID in the Files configuration. |
Now on the 'Files' tab, select the Create new Files... link and configure the following fields
...
After the configuration is saved, it should look similar to below:
...
...
With a File record created following the steps in Configure MQTT Transmission to publish files with the 'Enable Auto-Publish' unchecked and the Tag Folder Path set to "files_manual"At this point, everything should be configured to send files from MQTT Transmission to MQTT Engine.
Open Ignition Designer on the system running MQTT Transmission. You should see the control and information tags created in the specified tag provider and folder as shown below:
...
The control and information tags created in the folder are:
Name | Type | Description |
---|---|---|
Last Published File | String | Name of last published file |
Last Published Sequence Number | Integer | Sequence number of last published file since last reset of metrics |
Percent Completed | Byte | Publish completion percent for file being published |
Publish File | Boolean | Manual trigger to publish file |
Publish File Count | Long | Number of files published since last reset of metrics |
Publish File in Transit | String | Name of current file being published |
Publish Files Path | String | Full path to the target file to publish over MQTT |
Publish Operation Status | String | Status description of current publish operation |
Publish Operation Status Code | Integer | Status code for current publish operation |
Reset | Boolean | Trigger to reset publish metrics |
At this point, we just need to tell MQTT Transmission which file to send. Download and unzip this sample file to some location and note that location.
This sample_file.zip which contains two text files . The two text files which are:
sample_file.txt
sample_file.txt.md5
Note |
---|
The md5 sum file is only required when using the auto publish method. This is needed to ensure that the file to be transferred is complete and ready to be published. |
Note |
---|
If you are testing with a different file, certain |
Note |
Certain characters have special meanings when used in filenames such as "*" for wildcards, and "\" in filename paths. If a file you are trying to publish contains any of the characters listed below, it will prevent files from being written to the file system. " * : < > ? / \ | Leading and trailing spaces in filenames and filenames ending in '.' are also not supported. |
With the file to be transferred in place, we can now set the 'Publish File Path' tag.
This path must be the full path to the target file to publish over MQTT. In this example, we're using the path of '/tmp/transmission/sample_file.txt'. However, on a Windows system that would look something like 'C:\full\path\to\my\sample_file.txt'. When this is set, you should see something like this
Finally, click the 'Publish File' boolean tag. This will begin the file publish process which will cause the file to be published.
...
After doing so, you should see something similar to what is shown below.
You should also now see the file to the location you set as the 'Base File Directory' in your MQTT Engine namespace configuration for Sparkplug B.
Note |
---|
The files will be left on the originating filesystem after a successful publish and will need to be removed manually |
With a File record created following the steps in Configure MQTT Transmission to publish files with 'Enable Auto-Publish' checked and the Tag Folder Path set to "files_auto", everything should be configured to send files from MQTT Transmission to MQTT Engine.
Open Ignition Designer on the system running MQTT Transmission. You should see the control and information tags created in the specified tag provider and folder as shown below:
The control and information tags created in the folder are:
Name | Type | Description |
---|---|---|
Last Published File | String | Name of last published file |
Last Published Sequence Number | Integer | Sequence number of last published file since last reset of metrics |
Percent Completed | Byte | Publish completion percent for file being published |
Publish File Count | Long | Number of files published since last reset of metrics |
Publish File in Transit | String | Name of current file being published |
Publish Files Folder | String | Full path to the target folder containing the files to publish over MQTT |
Publish Operation Status | String | Status description of current publish operation |
Publish Operation Status Code | Integer | Status code for current publish operation |
Reset | Boolean | Trigger to reset publish metrics |
At this point, we just need to tell MQTT Transmission which folder contains the file(s) to publish. Download and unzip Unzip this sample file to some location and note that location.
This sample_file.zip contains two text files which are:
sample_file.txt
...
sample_file.txt.md5
Note |
---|
If you a testing with a different file, certain characters have special meanings when used in filenames such as "*" for wildcards, and "\" in filename paths. If a file you are trying to publish contains any of the characters listed below, it will prevent files from being written to the file system. " * : < > ? / \ | Leading and trailing spaces in filenames and filenames ending in '.' are also not supported. |
Note | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
When transferring files using auto_publish, MQTT Transmission requires two files to be present before it will transfer the target file. The first is the file itself. The second is a file that has the same name as the target file followed by a '.md5' extension. The file containing the md5 sum of the target file will not be transferred. The contents of that file must contain the Message Digest Algorithm 5 (or MD5 sum) of the file. The MD5 sum can be calculated using command line utilities on most operating systems or through scripting in Ignition. Here are some examples: Linux
OSX
Windows
|
With both files in place, we can now set the 'Publish File Path' tag.
This path must be the full path to the target file to publish over MQTT. In this example, we're using the path of '/tmp/transmission/sample_file.txt'. However, on a Windows system that would look something like 'C:\full\path\to\my\sample_file.txt'. When this is set, you should see something like this
Finally, click the 'Publish File' boolean tag. This will begin the file publish process which will cause the file to be published. After doing so, you should see something similar to what is shown below.
You should also now see the file to the location you set as the 'Base File Directory' in your MQTT Engine namespace configuration for Sparkplug B.
Note |
---|
With the File Auto_Publish disabled, the files will be left on the originating filesystem after a successful publish and will need to be removed manually |
...
Ignition Script
|
MQTT Transmission will scan the folder specified in the tag, with a frequency defined by the File Scan Rate, and publish all files that appear in this directory automatically.
Note |
---|
When the file is successfully transferred both the file and associated md5 sum file will be removed from the originating filesystem. |
The records published from MQTT Transmission can be be viewed in the Ignition Gateway logs by setting the com.cirruslink.mqtt.engine.gateway.sparkplug.SparkplugPayloadHandler logger to TRACE.
Tip |
---|
Review the Gateway Loggers from Ignition for details on how to do this. |
...
At this point you have a fully functional system which can be expanded or modified as required. Below are some addition configuration options to try:
Create a new File record following Step 4 in tutorial checking the 'Enable Auto-Publish' and configuring the Tag Folder Path to "files_auto".
With auto-publish enabled, MQTT Transmission will create a tag called 'Publish Files Folder' instead of 'Publish File Path' as shown below.
MQTT Transmission will scan the folder specified in the tag, with a frequency defined by the File Scan Rate, and publish all files that appear in this directory automatically. When the file is successfully transferred both the file and associated md5 sum file will be removed from the originating filesystem.
Just as with the 'manual publish' option, an associated md5 sum file must be present and properly represent the md5 sum of the target file before it will be published.
...