Templates
To make it easier to add several similar dataflows (e.g. 30 machines of the same type), you can also
make use of .yaml
templates in the flows ui. In the menu in the top right corner on the flows page,
you can both export your current configuration as a template and upload a template to add a bunch of
connectors and data mappers in one go.
Exporting a template
After configuring your system you can export it to a .yaml
template. The templates are capable of
saving the connectors and the data mappers with all their properties, transformations and mappings aswell
as all the nodes you made in the Reniway OPC UA Server.
You can download a template through the menu in the top right corner of the flows page.
Creating a Template
Imagine the following example: you have a machine that publishes all its data to MQTT but you want to publish all data to OPC UA.
The machine publishes its data to the topic machine/data
like so:
{
temperature: 23.241
}
The OPC UA address space will look like this:
Objects
├ Aliases
├ IoTDevices
├ Machine
│ └ Temperature
└ Server
Types
Views
The data will be published in a new folder named Machine
inside of Objects
which represents your
machine.
OPC UA Server
Nodes can be added to the Reniway OPC UA server under opcua
.
# The OPC UA Server
opcua:
nodes:
- browseName: 0:Root
displayName: Root
children:
- id: 0
browseName: 0:Objects
displayName: Objects
typeDefinition: 0:FolderType
referenceType: 0:HasComponent
children:
- id: 1 # Define a folder to represent
browseName: 2:Machine # your machine
displayName: Machine
typeDefinition: 0:FolderType
referenceType: 0:HasComponent
children:
- id: 2 # Define a variable to
browseName: 2:Temperature # store the machine
displayName: Temperature # temperatures
typeDefinition: 0:BaseDataVariableType
referenceType: 0:HasComponent
dataType: 0:Double
children: []
namespaces:
- id: 0
uri: http://opcfoundation.org/UA/
- id: 2
uri: http://reniver.eu/UA/Reniway/Instance
Connectors
Connectors are defined under connectors
.
# Defining Connectors
connectors:
- name: Example MQTT Connector # Define a field connector to connect
properties: # to the machine and a property to
- id: 1 # capture the temperature
name: Temperature
topic: machine/data
jSONPath: temperature
direction: Input
type: double
settings:
- key: host # Add the correct host name and port to connect to
value: localhost # the MQTT broker
- key: port
value: 1883
- key: useTls
value: false
- key: useAuthentication
value: false
startup: true
type: MQTT
connectorCategoryType: Field
- name: Reniway OPC UA Server # Define an enterprise connector to connect
properties: # to the Reniway OPC UA Server and a property
- id: 2 # to publish the temperature
name: Temperature
valueFromDataMapperPropertyId: 1 # Receive value from data mapper
nodeId: 2
direction: Output
type: double
settings: []
startup: true
type: ReniwayOPCUA
connectorCategoryType: Enterprise
Data Mappers
Data Mappers are defined under dataMappers
.
# Defining a Data Mapper
dataMappers:
- name: Machine # Define a data mapper to represent
properties: # your machine
- name: Temperature
valueFromConnectorPropertyId: 1 # Receive value from field connector
type: double
Full Template
After putting everything together the full template will look like this:
# The full .yaml file
opcua:
nodes:
- browseName: 0:Root
displayName: Root
children:
- id: 0
browseName: 0:Objects
displayName: Objects
typeDefinition: 0:FolderType
referenceType: 0:HasComponent
children:
- id: 1
browseName: 2:Machine
displayName: Machine
typeDefinition: 0:FolderType
referenceType: 0:HasComponent
children:
- id: 2
browseName: 2:Temperature
displayName: Temperature
typeDefinition: 0:BaseDataVariableType
referenceType: 0:HasComponent
dataType: 0:Double
children: []
namespaces:
- id: 0
uri: http://opcfoundation.org/UA/
- id: 2
uri: http://reniver.eu/UA/Reniway/Instance
connectors:
- name: Example MQTT Connector
properties:
- id: 1
name: Temperature
topic: machine/data
jSONPath: temperature
direction: Input
type: double
settings:
- key: host
value: localhost
- key: port
value: 1883
- key: useTls
value: false
- key: useAuthentication
value: false
startup: true
type: MQTT
connectorCategoryType: Field
- name: Reniway OPC UA Server
properties:
- id: 2
name: Temperature
valueFromDataMapperPropertyId: 1
nodeId: 2
direction: Output
type: double
settings: []
startup: true
type: ReniwayOPCUA
connectorCategoryType: Enterprise
dataMappers:
- name: Example Data Mapper
properties:
- name: Temperature
valueFromConnectorPropertyId: 1
type: double
Uploading the template
After saving the template to a yaml
file you can upload the template through the menu in the top
right corner of the flows page.
After uploading the template all the connectors, the data mapper and the properties will be created and connected.
In the Reniway OPC UA server all the nodes will also be created and the data will be written.