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
| Parameter | Type | Description |
|---|---|---|
| type | String | Configuration type to create. Valid options are General and Tables. |
| props | Dictionary | Properties for the new configuration record. |
Supported Properties
General Configuration
| Property | Type |
|---|---|
| Id | Long |
| Enabled | Boolean |
| Datasource | String |
| PartitionPeriod | String |
Table Configuration
| Property | Type |
|---|---|
| Id | Long |
| TableName | String |
| Enabled | Boolean |
| RecordType | String |
| GroupId | String |
| EdgeNodeId | String |
| DeviceId | String |
| FilteredProperties | String |
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
| Parameter | Type | Description |
|---|---|---|
| type | String | Configuration type to read. Valid options are General and Tables. |
Returns
A list of dictionaries representing the requested configuration records.
General Configuration Properties
| Property | Type |
|---|---|
| Id | Long |
| Enabled | Boolean |
| Datasource | String |
| PartitionPeriod | String |
Table Configuration Properties
| Property | Type |
|---|---|
| Id | Long |
| TableName | String |
| Enabled | Boolean |
| RecordType | String |
| GroupId | String |
| EdgeNodeId | String |
| DeviceId | String |
| FilteredProperties | String |
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
| Parameter | Type | Description |
|---|---|---|
| type | String | Configuration type to update. Valid options are General and Tables. |
| id | Long | ID of the record to update. |
| collisionPolicy | String | Update behavior. Valid options are MergeOverwrite and Overwrite. |
| props | Dictionary | Properties to update on the configuration record. |
Collision Policies
| Policy | Description |
|---|---|
| MergeOverwrite | Replaces only the properties included in the request while preserving all other values. |
| Overwrite | Replaces all properties in the record with the values supplied in the request. |
Supported Properties
General Configuration
| Property | Type |
|---|---|
| Id | Long |
| Enabled | Boolean |
| Datasource | String |
| PartitionPeriod | String |
Table Configuration
| Property | Type |
|---|---|
| Id | Long |
| TableName | String |
| Enabled | Boolean |
| RecordType | String |
| GroupId | String |
| EdgeNodeId | String |
| DeviceId | String |
| FilteredProperties | String |
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
| Parameter | Type | Description |
|---|---|---|
| type | String | Configuration type to delete. Valid options are General and Tables. |
| id | Long | ID of the record to delete. |
Returns
| Type | Description |
|---|---|
| Boolean | Returns 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