Skip to main content

API Reference with Python Scripting

Overview​

MQTT Recorder provides a set of scripting functions that allow you to create, read, update, and delete Recorder configuration settings programmatically.

These functions can be executed from any Ignition Scripting Scope.

The available functions are:

  • createConfig() – Create a new configuration record.
  • readConfig() – Retrieve existing configuration settings.
  • updateConfig() – Modify an existing configuration record.
  • deleteConfig() – Remove a configuration record.

These functions can be used to manage MQTT Recorder settings and table definitions without manually configuring them through the Gateway web interface.


createConfig()​

Creates a new MQTT Recorder configuration record.

Syntax​

system.cirruslink.recorder.createConfig(type, props)

Parameters​

ParameterTypeDescription
typeStringConfiguration type to create. Valid options are General and Tables.
propsDictionaryProperties for the new configuration record.

Supported Properties​

General Configuration​

PropertyType
IdLong
EnabledBoolean
DatasourceString
PartitionPeriodString

Table Configuration​

PropertyType
IdLong
TableNameString
EnabledBoolean
RecordTypeString
GroupIdString
EdgeNodeIdString
DeviceIdString
FilteredPropertiesString

Returns​

A dictionary representing the newly created configuration record after it has been written to the database.

⚠️ Added in MQTT Recorder 4.0.16.

Example​

props = {
"TableName": "rs_Event",
"RecordType": "Event",
"Enabled": True
}

system.cirruslink.recorder.createConfig(
"Tables",
props
)

readConfig()​

Retrieves MQTT Recorder configuration records.

Syntax​

system.cirruslink.recorder.readConfig(type)

Parameters​

ParameterTypeDescription
typeStringConfiguration type to read. Valid options are General and Tables.

Returns​

A list of dictionaries representing the requested configuration records.

General Configuration Properties​

PropertyType
IdLong
EnabledBoolean
DatasourceString
PartitionPeriodString

Table Configuration Properties​

PropertyType
IdLong
TableNameString
EnabledBoolean
RecordTypeString
GroupIdString
EdgeNodeIdString
DeviceIdString
FilteredPropertiesString

Example​

tables = system.cirruslink.recorder.readConfig("Tables")

for table in tables:
print table["TableName"]

updateConfig()​

Updates an existing MQTT Recorder configuration record.

Syntax​

system.cirruslink.recorder.updateConfig(
type,
id,
collisionPolicy,
props
)

Parameters​

ParameterTypeDescription
typeStringConfiguration type to update. Valid options are General and Tables.
idLongID of the record to update.
collisionPolicyStringUpdate behavior. Valid options are MergeOverwrite and Overwrite.
propsDictionaryProperties to update on the configuration record.

Collision Policies​

PolicyDescription
MergeOverwriteReplaces only the properties included in the request while preserving all other values.
OverwriteReplaces all properties in the record with the values supplied in the request.

Supported Properties​

General Configuration​

PropertyType
IdLong
EnabledBoolean
DatasourceString
PartitionPeriodString

Table Configuration​

PropertyType
IdLong
TableNameString
EnabledBoolean
RecordTypeString
GroupIdString
EdgeNodeIdString
DeviceIdString
FilteredPropertiesString

Returns​

A dictionary representing the updated configuration record after it has been written to the database.

⚠️ Added in MQTT Recorder 4.0.16.

Example​

props = {
"RecordType": "Alarm"
}

system.cirruslink.recorder.updateConfig(
"Tables",
1,
"MergeOverwrite",
props
)

deleteConfig()​

Deletes an MQTT Recorder configuration record.

Syntax​

system.cirruslink.recorder.deleteConfig(type, id)

Parameters​

ParameterTypeDescription
typeStringConfiguration type to delete. Valid options are General and Tables.
idLongID of the record to delete.

Returns​

TypeDescription
BooleanReturns True if the record was successfully deleted; otherwise returns False.

⚠️ Added in MQTT Recorder 4.0.16.

Example​

success = system.cirruslink.recorder.deleteConfig(
"Tables",
1
)

print success