Basic Operations

The following basic operations are available for the MQTT Transmission Module and can be executed within any of the available Ignition scopes using the format system.cirruslink.transmision.operation

  • createConfig(type, name, config, enabled, description)
    • enabled (boolean) and description (string) are optional calls
    • returns a dictionary that represents the config.json of the specified resource
  • deleteConfig(type, name)
    • returns a boolean
  • getConfigNames(type, enabled)
    • enabled is an optional call
    • returns a list strings
  • isConfigEnabled(type, name)
    • returns a boolean
  • readConfig(type, name)
    • returns a dictionary that represents the config.json of the specified resource
  • setConfigEnabled(type, name, enabled)
    • returns a boolean 
  • updateConfig(type, name, collisionPolicy, config)
    • returns a dictionary that represents the config.json of the specified resource

where:

  • type
    • string denoting the type of configuration to operate on
  • name
    • string denoting the unique name for the configuration resource to operate on
  • config
  • enabled
    • boolean
  • collisionPolicy
    • string with options "MergeOverwrite" or "Overwrite"
      • "MergeOverwrite" will replace the existing properties in the resource name with only those included in the call
      • "Overwrite" will replace all properties in the resource name with those in the call


Configuration changes made through scripting do have the same validation as when made through the UI. 

For example, attempting to delete a Sets configuring that is being referenced by a Servers configuration will result in no action being performed.

The logs will show an error

Extended Operations

The following extended operations are available for the MQTT Transmission Module and can be executed within any of the available Ignition scopes using the format system.cirruslink.transmision.operation

  • publish(mqttServerName, topic, payload, qos, retained)

where:

  • mqttServerName
    • string
    • name of the server or server set to use from the MQTT Transmission Server configuration.
    • this must match an existing server or server set name in the configuration
  • topic
    • string
    • valid MQTT topic to publish on
  • payload
    • array
    • bytes representing the MQTT payload
  • qos
    • integer
    • the MQTT 'Quality of Service' to use
    • must be either 0,1 or 2
  • retained
    • boolean 
    • whether or not to publish this message with the retain flag set

Transmission 'type' keys

Transmission 'general' keys

keyNamedataTypeDescription
enabledboolean

Whether or not the configuration resource is enabled

namestring

The unique name for the configuration resource

enableTransmissionboolean

Whether or not Transmission is enabled

auditProfilestring

The optional Ignition Audit Profile to use

Transmission 'file' keys

keyNamedataTypeDescription
enabledboolean

Whether or not the configuration resource is enabled

namestringThe unique name for the configuration resource
tagProviderstringThe name of the tag provider where the file control and information tags will be created
tagFolderPathstringThe path to the Tag folder under the specified Tag Provider where the file control and information tags will be created
enableAutoPublishingboolean

Enable auto-publishing

fileScanRateinteger

The rate to scan the 'Files' directory specified in the 'Publish Files Path' tag for files to publish

fileScanRateTimeUnitstring

Time Unit for the 'File Scan Rate' configuration parameter. Default is SECONDS

groupIdstring

To publish files MQTT Transmission uses a configured Transmitter. The Group ID must match an existing Sparkplug Edge Node and cannot be null

edgeNodeIdstring

To publish files MQTT Transmission uses a configured Transmitter. The Edge Node ID must match an existing Sparkplug Edge Node and cannot be null

deviceIdstring

To publish files MQTT Transmission uses a configured Transmitter. The Device ID that matches an existing Sparkplug Edge Node (Optional)

messageSizeinteger

Number of bytes to transfer in one message

messagePacingPeriodinteger

Message Pacing Period in milliseconds

messageAckTimeoutinteger

Message acknowledgement timeout in seconds

numberRetriesinteger

Number of retries to publish a file or a chunk of a file

submitBasicFileAttributesboolean

If checked, the metrics will contain basic file attributes (i.e. CreationTime, LastModifiedTime, and LastAccessTime)

Transmission 'history-store' keys

keyNamedataTypeDescription
enabledboolean

Whether or not the configuration resource is enabled

namestringThe unique name for the configuration resource
transmissionHistoryStoreTypestringHistory Store type with options "In-Memory" or "Disk-Backed"
historyMaxSizeintegerMaximum number of megabytes history can use before dropping the data
historyMaxAgeintegerMaximum number of minutes to store history before dropping the data
flushQuantityintegerUpon reestablishing communication, the maximum number of tags tags to publish at a time
flushPeriodintegerUpon reestablishing communication, the period to wait in milliseconds between publishes in flushing messages
h2dbDirectorystringDirectory to store the H2 Database in. Applicable for "Disk-Backed" history store only
h2dbPortintegerTCP Port to connect to H2 Database. Applicable for "Disk-Backed" history store only
dbMaxMetricSizeintegerThe Max Metric size allowed in the Store and Forward DB. Applicable for "Disk-Backed" history store only
rollingHistoryBufferEnabledbooleanStore data in a rolling buffer to cover data loss in keep alive timeout scenario
rollingHistoryPruneIntervallongInterval at which to attempt to prune the rolling history buffer in seconds
rollingHistoryMaxAgeintegerThe maximum age allowed of data in the rolling history buffer in seconds
rollingHistoryPruneQuantityintegerThe number of metrics to prune in a single block

Transmission 'record' keys

keyNamedataTypeDescription
enabledboolean

Whether or not the configuration resource is enabled

namestringThe unique name for the configuration resource
tagProviderstringThe name of the tag provider
tagFolderPathstringThe path to the tag folder
recordTypestringType of record
groupIdstringTo publish records MQTT Transmission uses a configured Transmitter. The Group ID must match an existing Sparkplug Edge Node and cannot be null
edgeNodeIdstringTo publish records MQTT Transmission uses a configured Transmitter. The Edge Node ID must match an existing Sparkplug Edge Node and cannot be null
deviceIdstringTo publish records MQTT Transmission uses a configured Transmitter. The Device ID that matches an existing Sparkplug Edge Node
overridePublishTagbooleanOverrides the default 'Publish Tag' in the Record defined folder path
publishTagPathstringThe full tag path to the tag to use as the trigger for the Record publish
enableSignaturebooleanEnables a digital signature field on all Records
hashingAlgorithmstringThe hashing algorithm to use when generating the digital signature. Options are SHA_1, SHA_224, SHA_256, SHA_384, SHA_512
signaturePasswordstringThe password used to generate the PBE secret key for encrypting the digital signature

Transmission 'cert-file' keys

keyNamedataTypeDescription
enabledboolean

Whether or not the configuration resource is enabled

fileNamestring

The name of this certificate file or private key

descriptionstring

The description of this certificate file or private key

fileContentsstring

The contents of this certificate file or private key

Transmission 'server' keys

keyNamedataTypeDescription
enabledboolean

Whether or not the configuration resource is enabled

namestringThe unique name for the configuration resource
urlstringThe URL of the MQTT Server to connect to. Should be of the form tcp://mydomain.com:1883 or ssl://mydomain.com:8883
mqttServerConnectionEnabledbooleanEnable this MQTT Server connection
serverSetstringThe Server Set this MQTT Server is associated with
clientIdstringClient ID for this MQTT connection 
usernamestringThe username for this MQTT connection if required by the MQTT Server
passwordstringThe password for this MQTT connection if required by the MQTT Server
caCertFilestringFileName of the CA Certificate file to use
clientCertFilestringFileName of client certificate file to use
clientPrivateKeyFilestringFileName of client private key file to use
clientKeyPasswordstringThe password associated with the certificate's private key 
hostNameVerificationbooleanEnable TLS Hostname Verification
tlsAlpnExtensionsstringThe TLS ALPN Extensions to use with this connection (optional)
keepAliveintegerThe MQTT Client keep alive time (in seconds)
randomStartupDelaystringThe Random Startup Delay in milliseconds of the form 'min-max' where min is the low end and max is the high end of the random range
reconnectDelaylongTransmission Client's reconnect delay in milliseconds
subscribeToLegacyStateTopicbooleanTransmission Client will subscribe to a legacy state topic (e.g. STATE/IamHost) for primary host ID notifications
dataFormatTypeWrapperstringThe format of the data to send.  Options are "Sparkplug_B_v1_0_Protobuf" or "Sparkplug_B_v1_0_JSON"
rpcClientIdstringClient ID for this RPC connection
rpcUsernamestringThe username for RPC connection if required by the MQTT Server 
rpcPasswordstringThe password for RPC connection if required by the MQTT Server 
rpcCaCertFilestringFileName of the CA Certificate file to use
rpcClientCertFilestringFileName of client certificate file to use
rpcClientPrivateKeyFilestringFileName of client private key file to use
rpcClientKeyPasswordstringThe password associated with the certificate's private key 
rpcHostnameVerificationbooleanEnable TLS Hostname Verification
rpcTlsAplnExtensionsstringThe TLS ALPN Extensions to use with the RPC connection 

Transmission 'server-set' keys

keyNamedataTypeDescription
enabledboolean

Whether or not the configuration resource is enabled

namestringThe unique name for the configuration resource
primaryHostIdstringPrimary Host ID of the backend application the MQTT clients in MQTT Transmission should remain connected to 
rpcClientEnabledbooleanEnable the RPC MQTT Client which is used for publishing from Ignition Python scripts
autoReconnectRpcClientbooleanIf set, the RPC client will automatically reconnect to the server otherwise will reconnect at publish time
randomizeServerConnectionsbooleanWhether or not to randomly connect to each server in the set. If true, the server to connect to will be randomly selected. Otherwise, it connects to the next server in the list

Transmission 'transmitter' keys

keyNamedataTypeDescription
enabledboolean

Whether or not the configuration resource is enabled

namestringThe unique name for the configuration resource
tagPathstringA path to the root folder where the tag tree starts 
tagPacingPeriodlongThe waiting period in milliseconds after an initial tag change event before publishing all changed tags
serverSetstringThe name of the Server Set to use with this Transmitter
discoveryDelaylongThe Discovery Delay in milliseconds
historyStorestringThe name of the History Store to use with this Transmitter
enableStoreForwardByDefaultbooleanEnable store and forward by default on all tags
inOrderHistorybooleanFlush history in-order (synchronously) before live data resumes
alarmEventEnablebooleanWhether or not to publish alarm events on tags via MQTT
alarmJournalNamestringThe pre-configured alarm journal name to use for alarm reconciliation
aliasedTagsbooleanUse aliases for tag names to optimize payload sizes when publishing data. Not supported when publishing UDTs
compressionTypeWrapperstringThe algorithm to use for compressing payloads before publishing. Options are "NONE" "DEFLATE" or "GZIP"
convertUDTsbooleanConverts UDT members to normal Tags before publishing
deviceLevelUdtsAsDevicesbooleanTreat 'device level UDTs as Sparkplug devices'. ConvertUDTs must be true
publishUdtDefinitionsbooleanPublish UDT Definitions in BIRTH
optimizeUdtsbooleanOptimizes UDT payload sizes in NDATA and DDATA payloads
blockCommandsbooleanBlock incoming commands (writes) to Edge Node and Device Tags
validateSecurityContextbooleanWhether or not to validate the Security Context in write commands
securityContextHashingAlgorithmstringThe hashing algorithm to use when decrypting the Security Context. Options are SHA_1, SHA_224, SHA_256, SHA_384, SHA_512 
securityContextHashingPasswordstringThe hashing password to use when decrypting the Security Context
publishBEDbooleanPublish data using BED format instead of Sparkplug format
hcpIdstringThe HCP ID of the Transmitter for BED publishing
echoRequestTimeoutintegerThe Echo Request Timeout of the Transmitter for BED publishing - set to zero to disable
groupIdstringAn ID representing a logical grouping of Edge Nodes and Devices (optional)
edgeNodeIdstringAn ID representing an Edge or Network (EoN) Node (optional)
deviceIdstringAn ID representing a Device (optional)
filteredPropertiesstringA semicolon delimited list of Tag properties to filter/block from being published
rebirthBounceDelaylongThe amount of time to delay before processing Rebirth NCMD requests after one has been processed (in milliseconds)
includeSparkplugDataTypesbooleanWhether or not to include Sparkplug DataTypes for Metrics in Sparkplug DATA payloads
useCirrusEncoderbooleanWhether to use the Cirrus Link Encoder which will use special encoding for non-Sparkplug supported PropertyDataTypes
birthSettleDelaylongThe amount of time to wait after setting the BIRTH timestamp before grabbing the cached BIRTH payloads
calculatedSparkplugIdsstringSparkplug Id created using Ignition tagpath
sendAllPropsbooleanSend all properties, including non-default properties, in Sparkplug BIRTH messages
reconciliationWindowlongThe reconciliation window in milliseconds

Transmission 'uns_transmitter' keys

keyNamedataTypeDescription
enabledboolean

Whether or not the configuration resource is enabled

namestringThe unique name for the configuration resource
tagProviderstringThe Name of the tag provider
tagPathstringA path to the root folder where the tag tree starts 
serverSetstringThe name of the Server Set to use with this Transmitter
discoveryDelaylongThe Discovery Delay in milliseconds
propsQosintegerThe MQTT Quality of Service to use for 'properties' messages
propsRetainbooleanWhether or not to set the MQTT retain flag to true for 'properties' messages
dataQosintegerThe MQTT Quality of Service to use for 'data' messages
dataRetainbooleanWhether or not to set the MQTT retain flag to true for 'data' messages
historyStorestringThe name of the History Store to use with this Transmitter
enableStoreForwardByDefaultbooleanEnable store and forward by default on all tags
inOrderHistorybooleanFlush history in-order (synchronously) before live data resumes
convertUDTsbooleanConverts UDT members to normal Tags before publishing
deviceLevelUdtsAsDevicesbooleanTreat 'device level UDTs as Sparkplug devices'. ConvertUDTs must be true
publishUdtDefinitionsbooleanPublish UDT Definitions in BIRTH
optimizeUdtsbooleanOptimizes UDT payload sizes in NDATA and DDATA payloads
filteredPropertiesstringA semicolon delimited list of Tag properties to filter/block from being published
rebirthBounceDelaylongThe amount of time to delay before processing Rebirth NCMD requests after one has been processed (in milliseconds)
includeSparkplugDataTypesbooleanWhether or not to include Sparkplug DataTypes for Metrics in Sparkplug DATA payloads
birthSettleDelaylongThe amount of time to wait after setting the BIRTH timestamp before grabbing the cached BIRTH payloads
sendAllPropsbooleanSend all properties, including non-default properties, in .props messages




Sample Scripts


Cirrus Link provides these scripts as examples only, they are not supported or guaranteed to meet any particular functionality. Cirrus Link cannot provide any assistance to modify these scripts to meet a particular need.
# Cirrus Link provides these scripts as examples only, they are not supported or guaranteed to meet any particular functionality. Cirrus Link cannot provide any assistance to modify these scripts to meet a particular need.

# Create Transmitter One
transmitterProps = {}
transmitterProps["tagProvider"] = "default"
transmitterProps["tagPath"] = ""
transmitterProps["tagPacingPeriod"] = 1000
transmitterProps["serverSet"] = "Default"
transmitterProps["discoveryDelay"] = 0
transmitterProps["aliasedTags"] = False
transmitterProps["compressionTypeWrapper"] = "NONE"
transmitterProps["blockCommands"] = False
transmitterProps["convertUdts"] = True
transmitterProps["publishUdtDefinitions"] = True
transmitterProps["optimizeUdts"] = True
transmitterProps["cacheBirthsEnabled"] = False
#transmitterProps["historyStore"] = None
transmitterProps["enableStoreForwardByDefault"] = True
transmitterProps["inOrderHistory"] = False
transmitterProps["groupId"] = "Test1G"
transmitterProps["edgeNodeId"] = "Test1E"
transmitterProps["deviceId"] = None
transmitterProps["filteredProperties"] = "accessRights;clampMode;deadband;deadbandMode;formatString;historicalDeadband;historicalDeadbandMode;historicalDeadbandStyle;historyEnabled;historyMaxAge;historyMaxAgeUnits;historyProvider;historySampleRate;historySampleRateUnits;historyTagGroup;historyTimeDeadband;historyTimeDeadbandUnits;opcItemPath;opcServer;permissionModel;rawHigh;rawLow;sampleMode;scaleFactor;scaleMode;scaledHigh;scaledLow;tagGroup;valueSource;expression;expressionType;ConfiguredTagPath;eventScripts;readPermissions;writePermissions;eventScripts"
transmitterProps["rebirthDebounceDelay"] = 5000
system.cirruslink.transmission.createConfig("Transmitter", "CustomOne", transmitterProps, True, "My First Custom Transmitter")

# MQTT Transmission Update Existing Transmitter using MergeOverwrite
transmitterProps = {}
transmitterProps["GroupId"] = "Test2G"
transmitterProps["EdgeNodeId"] = "Test2E"
system.cirruslink.transmission.updateConfig(“Transmitter”, "CustomOne", “MergeOverwrite”, transmitterProps)

# Delete Config
system.cirruslink.transmission.deleteConfig("Transmitter", "CustomOne")



  • No labels