Custom Templates#
The Custom Templates task is used to add properties, events and commands to a Driver Definition through JSON content.
Details#
| Fields | Details |
|---|---|
| Scope | Connect IoT |
| Workflow | Data flow Control flow |
IsProtocol flag |
Inputs#
| Name | Data Type | Description |
|---|---|---|
| Activate | any | Activates the task. |
Outputs#
| Name | Data Type | Description |
|---|---|---|
| Success | Boolean | Emits true when the command executes successfully. |
| Error | Error | Returns error details if the command fails. |
Settings#
On the General Tab, you have only the usual settings:
On the Templates Tab you have the following settings:
| Name | Data Type | Default Value | Description |
|---|---|---|---|
| Name | String | Template Name. | |
| Description | String | The description of template value. | |
| Template | any | Value for the template (JSON) |
Behavior#
The Custom Templates task is used to add properties, events and commands to a Driver Definition through JSON content. The Templates tab provides an option to create a template and enter JSON in the Template section to define these elements. The system stores this information and links it to the current Driver Definition.
The template information loads in sequence. When two events share the same name, the most recent event replaces the earlier one. The same rule applies when a single event already exists with the same name.
This task streamlines the process by removing the need to manually create properties, events, or commands on the Driver Definition page.
Remarks#
We recommend using this task between the Equipment Configuration task and the Driver Command Connect task. 
This task should receive a specific structure of data at Template section. That structure is represented at the Example topic.
Example#
Structure to add properties:
{
"property": [
{
"Name": "FileName",
"Description": "Name of the file identified in the watched directory",
"DevicePropertyId": "FileName",
"DataType": "String",
"IsWritable": false,
"IsReadable": true,
"AutomationProtocolDataType": "String",
"ExtendedData": {
"propertyType": "FileName",
"identifierType": "None"
}
},
{
"Name": "FullPath",
"Description": "Full path of the file found in the directory",
"DevicePropertyId": "FullPath",
"DataType": "String",
"IsWritable": false,
"IsReadable": true,
"AutomationProtocolDataType": "String",
"ExtendedData": {
"propertyType": "FullPath",
"identifierType": "None"
}
},
{
"Name": "FileSize",
"Description": "Size of the file",
"DevicePropertyId": "FileSize",
"DataType": "Integer",
"IsWritable": false,
"IsReadable": true,
"AutomationProtocolDataType": "Integer",
"ExtendedData": {
"propertyType": "Size",
"identifierType": "None"
}
},
{
"Name": "EndOfFile",
"Description": "End of file reached",
"DevicePropertyId": "EndOfFile",
"DataType": "Boolean",
"IsWritable": false,
"IsReadable": true,
"AutomationProtocolDataType": "Boolean",
"ExtendedData": {
"propertyType": "EndOfFile",
"identifierType": "None"
}
}
]
}
Structure to add an event (properties are needed too):
{
"property": [
{
"Name": "FileName",
"Description": "Name of the file identified in the watched directory",
"DevicePropertyId": "FileName",
"DataType": "String",
"IsWritable": false,
"IsReadable": true,
"AutomationProtocolDataType": "String",
"ExtendedData": {
"propertyType": "FileName",
"identifierType": "None"
}
},
{
"Name": "FullPath",
"Description": "Full path of the file found in the directory",
"DevicePropertyId": "FullPath",
"DataType": "String",
"IsWritable": false,
"IsReadable": true,
"AutomationProtocolDataType": "String",
"ExtendedData": {
"propertyType": "FullPath",
"identifierType": "None"
}
},
{
"Name": "FileSize",
"Description": "Size of the file",
"DevicePropertyId": "FileSize",
"DataType": "Integer",
"IsWritable": false,
"IsReadable": true,
"AutomationProtocolDataType": "Integer",
"ExtendedData": {
"propertyType": "Size",
"identifierType": "None"
}
},
{
"Name": "EndOfFile",
"Description": "End of file reached",
"DevicePropertyId": "EndOfFile",
"DataType": "Boolean",
"IsWritable": false,
"IsReadable": true,
"AutomationProtocolDataType": "Boolean",
"ExtendedData": {
"propertyType": "EndOfFile",
"identifierType": "None"
}
}
],
"event": [
{
"Name": "OnNewFile",
"Description": "Triggered when the watcher detects a file that was not previously identified appears",
"DeviceEventId": "NewFile",
"IsEnabled": true,
"ExtendedData": {
"eventTrigger": "NewFile"
},
"EventProperties": [
{
"Property": "FileName",
"Order": 1,
"ExtendedData": {}
},
{
"Property": "FullPath",
"Order": 2,
"ExtendedData": {}
},
{
"Property": "FileSize",
"Order": 3,
"ExtendedData": {}
}
]
}
]
}
Structure to add a command:
{
"command": [
{
"Name": "MoreDataRequest",
"Description": "After Data is processed, request for the next chunk.",
"DeviceCommandId": "MoreDataRequest",
"ExtendedData": {
"commandType": "MoreDataRequest"
},
"Parameters": [
{
"Name": "path",
"Description": "Path of the file",
"Order": 1,
"DataType": "String",
"AutomationProtocolDataType": "String",
"DefaultValue": "",
"IsMandatory": true,
"ExtendedData": {}
}
]
}
]
}
Structure to add properties, events and commands:
{
"property": [
{
"Name": "FileName",
"Description": "Name of the file identified in the watched directory",
"DevicePropertyId": "FileName",
"DataType": "String",
"IsWritable": false,
"IsReadable": true,
"AutomationProtocolDataType": "String",
"ExtendedData": {
"propertyType": "FileName",
"identifierType": "None"
}
},
{
"Name": "FullPath",
"Description": "Full path of the file found in the directory",
"DevicePropertyId": "FullPath",
"DataType": "String",
"IsWritable": false,
"IsReadable": true,
"AutomationProtocolDataType": "String",
"ExtendedData": {
"propertyType": "FullPath",
"identifierType": "None"
}
},
{
"Name": "FileSize",
"Description": "Size of the file",
"DevicePropertyId": "FileSize",
"DataType": "Integer",
"IsWritable": false,
"IsReadable": true,
"AutomationProtocolDataType": "Integer",
"ExtendedData": {
"propertyType": "Size",
"identifierType": "None"
}
},
{
"Name": "EndOfFile",
"Description": "End of file reached",
"DevicePropertyId": "EndOfFile",
"DataType": "Boolean",
"IsWritable": false,
"IsReadable": true,
"AutomationProtocolDataType": "Boolean",
"ExtendedData": {
"propertyType": "EndOfFile",
"identifierType": "None"
}
}
],
"event": [
{
"Name": "OnNewFile",
"Description": "Triggered when the watcher detects a file that was not previously identified appears",
"DeviceEventId": "NewFile",
"IsEnabled": true,
"ExtendedData": {
"eventTrigger": "NewFile"
},
"EventProperties": [
{
"Property": "FileName",
"Order": 1,
"ExtendedData": {}
},
{
"Property": "FullPath",
"Order": 2,
"ExtendedData": {}
},
{
"Property": "FileSize",
"Order": 3,
"ExtendedData": {}
}
]
},
{
"Name": "OnFileChanged",
"Description": "Triggered when the watcher detects a file that was already identified (and triggered the OnNewFile event), and it was changed in some way",
"DeviceEventId": "ChangedFile",
"IsEnabled": true,
"ExtendedData": {
"eventTrigger": "ChangedFile"
},
"EventProperties": [
{
"Property": "FileName",
"Order": 1,
"ExtendedData": {}
},
{
"Property": "FullPath",
"Order": 2,
"ExtendedData": {}
},
{
"Property": "FileSize",
"Order": 3,
"ExtendedData": {}
}
]
}
],
"command": [
{
"Name": "MoreDataRequest",
"Description": "After Data is processed, request for the next chunk.",
"DeviceCommandId": "MoreDataRequest",
"ExtendedData": {
"commandType": "MoreDataRequest"
},
"Parameters": [
{
"Name": "path",
"Description": "Path of the file",
"Order": 1,
"DataType": "String",
"AutomationProtocolDataType": "String",
"DefaultValue": "",
"IsMandatory": true,
"ExtendedData": {}
}
]
},
{
"Name": "FileOrDirectoryExists",
"Description": "Checks if the path location exists.",
"DeviceCommandId": "Exists",
"ExtendedData": {
"commandType": "Exists"
},
"Parameters": [
{
"Name": "path",
"Description": "Path of the file",
"Order": 1,
"DataType": "String",
"AutomationProtocolDataType": "String",
"DefaultValue": "",
"IsMandatory": true,
"ExtendedData": {}
}
]
}
]
}


