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
...
Code Block | ||
---|---|---|
| ||
# 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.
# MQTT Transmission Create Transmitter
# Get the Default Set ID
sets = system.cirruslink.transmission.readConfig("Sets")
for config in sets:
if config["Name"] == "Default":
setId = config["Id"]
logger.debug("New Set ID: " + str(setId))
# Create Transmitter One
transmitterProps = {}
transmitterProps["Name"] = "Custom One"
transmitterProps["Enabled"] = True
transmitterProps["TagProvider"] = "default"
transmitterProps["TagPath"] = ""
transmitterProps["TagPacingPeriod"] = 1000
transmitterProps["ServerSetId"] = setId
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("Transmitters", transmitterProps)
# MQTT Transmission Update Existing Transmitter
# Read Config
savedTransmitters = system.cirruslink.transmission.readConfig("Transmitters")
for config in savedTransmitters:
if config["Name"] == "Custom One":
logger.info("Transmitter Config: " + str(config))
customOneId = config["Id"]
# Update Config using MergeOverwrite
transmitterProps = {}
transmitterProps["GroupId"] = "Test2G"
transmitterProps["EdgeNodeId"] = "Test2E"
system.cirruslink.transmission.updateConfig(“Transmitters”, customOneId, “MergeOverwrite”, transmitterProps)
# Update Config using Overwrite
transmitterProps = {}
transmitterProps["Name"] = "Custom One"
transmitterProps["Enabled"] = True
transmitterProps["TagProvider"] = "default"
transmitterProps["TagPath"] = ""
transmitterProps["TagPacingPeriod"] = 1000
transmitterProps["ServerSetId"] = setId
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"] = "Test2G"
transmitterProps["EdgeNodeId"] = "Test2E"
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.updateConfig(“Transmitters”, customOneId, “Overwrite”, transmitterProps)
# Delete Config
system.cirruslink.transmission.deleteConfig("Transmitters", customOneId)
# Disable UNS topic prefix (unsA1.0)
transmitters = system.cirruslink.transmission.readConfig("UnsTransmitters")
name = "UNS Transmitter"
for transmitter in transmitters:
if transmitter["Name"] == name:
transmitterId = transmitter["Id"]
transmitterProps = {}
transmitterProps["UseTopicPrefixToken"] = False
system.cirruslink.transmission.updateConfig("UnsTransmitters", transmitterId, "MergeOverwrite", transmitterProps)
|