Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagepy
# 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: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)

...