APIs


Sample Script


# MQTT Transmission Create Transmitter
logger = system.util.logger("com.cirruslink.examples.transmitter.customtransmitters")

# 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)

# 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"]

# Delete Config
#system.cirruslink.transmission.deleteConfig("Transmitters", customOneId)