The following API calls are available for the MQTT Engine Module and can be executed within any of the available Ignition scopes.

There are sample API scripts available for each API call.

APIs


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.
# MQTT Transmission Create Transmitter

# Create new server
serverProps = {}
serverProps["Name"] = "My Server"
serverProps["Enabled"] = True
serverProps["Url"] = "ssl://192.0.2.1:8883"
serverProps["Username"] = "MyUserName"
serverProps["Password"] = "MyPassword"
serverProps["KeepAlive"] = "30"
system.cirruslink.engine.createConfig("Servers", serverProps)

# Read server configuration
savedServers = system.cirruslink.engine.readConfig("Servers")

# Find server Id
for config in savedServers:
	if config ["Name"] == "My Server":
	serverId = config["id"]

# Update server properties using MergeOverwrite
serverProps = {}
serverProps["KeepAlive"] = "60"
system.cirruslink.engine.createConfig("Servers", serverId, "MergeOverwrite", serverProps)

# Delete server
system.cirruslink.engine.deleteConfig("Servers", serverId)