Edge Gateway Adapter Common Configuration
interEdge Gateway Home > Adapter Common Configuration
Contents
Overview
An adapter in Datonis Edge Gateway refers to an independent module/plugin that allows data to be fetched from an environment or protocol (e.g. Modbus, OPC UA) and pushes data to Datonis platform. The various adapters are available in Services sections of Gateway interface's left pane.
Adapter Types
There are two types of adapters:
- Pull Data Adapter (Scanning Adapter) These adapters poll the target device at regular frequency specified via scan-interval. Any changes in the target device tag status will be known only during scan interval. Supported Pull Data Adapters are
- Modbus Adapter
- OPC UA Adapter
- MTConnect Adapter
- Simulator Adapter (CSV)
- Push Data Adapter (Listening Adapter) These adapters listen for the changes happened at target device. They specify scan-interval while subscribing change notification but target device may not honor it. Supported Push Data Adapters are
- OPC DA Adapter
- HttpListener Adapter
There are two ways to configure the adapter: Basic Configuration and Advanced Configuration. Basic Configuration can get start the adapter connectivity very quickly while Advanced Configuration allows finer control.
Basic Configuration
The Basic Configuration tab allows modifying the adapter configuration using CSV file. This is a simple way to import device tags to adapter configuration.
- enabled - this property value is responsible for enabling or disabling an adapter. A true value enable the adapter and will start pushing data.
- scan-interval-ms - In case of Pull Data Adapter (Modbus, OPC UA, MTConnect, Simulator), this frequency will be used to scan the target device. In case of Push Data Adapter, this frequency will be passed to target device.
- send-interval-ms - This property will be displayed only in case of Pull Data Adapter. With this frequency data will be sent to Datonis always.
- adapter specific connection properties - Rest of the properties are adapter specific and will be shown based on adapter selected.
Note that any change in above scan-interval-ms, send-interval-ms and adapter specific connection properties will be applied to all things.
Advanced Configuration
The Advanced Configuration tab allows modifying the underlying json structure of adapter configuration. This is a powerful way to control fine aspects of configuration.
- enabled - this property value is responsible for enabling or disabling an adapter. A true value enable the adapter and will start pushing data.
- config-json - this property value holds actual configuration of any specific adapter. The value of this property has to be a valid json data. There is an in-built json editor embedded to modify the config-json. It has three modes - Tree, Code and View. Tree mode allows editing and searching json properties easiliy. Code mode is for advanced configuration where raw config-json can be modified. View mode is read-only where tree view of config-json can be analyzed.
Generating sample config-json
To start creating a new configuration, its good idea to start with pre-populated configuration generated for all things. This is what precisely Generate config-json button does, it communicates with Datonis server, fetches all the things that belong to Cloud access key and secret key pair and creates mock configuration correctly mapped to all thing metrics.
Modifying config-json
The config-json is a special kind of property that holds entire configuration of the adapter. A valid value must be a proper JSON data structure. Elements of the JSON are described as below:
Root object
adapter_type | String | The type of the adapter, its generally a constant string and no need to modify |
thing_configs | thing_config Array | An array of thing_config object. Each thing_config object contains mapping required to transform source data into metric data |
thing_config object
thing_key | String | The thing key, Datonis UI location: Home → Things → Thing Key |
name | String | Name of the thing, Datonis UI location: Home → Things → Name |
description | String | Optional, Description of the thing, Datonis UI location: Home → Things → {thing name} → Description |
bi_directional | Boolean | Signifies whether the thing can accept instructions, Home → Things → Bi-directional |
send_interval_ms | Number | In pull data adapter case, this is a minimum interval (in milli seconds) at which thing metric data will be sent to Datonis |
scan_interval_ms | Number | In pull data adapter case, at this interval (in milli seconds) the data will be scanned from underlying source |
heartbeat_interval_ms | Number | The interval (in milli seconds) at which thing heart beat will be communicated to Datonis platform. |
source_tags | source_tag Array | An array of source_tag object. Each source_tag object defines the source specific connection object and source specific tag object. |
derived_tags | derived_tag Array | An array of derived_tag object. Each derived_tag object defined the expression based tag that is derived from either source_tag value or earlier defined derived_tag value. |
monitor_tag_ids | String Array | An array of tag_id defined in source_tags or derived_tags section. This list will be used to monitor the tag values at each scan defined by scan_interval_ms.
If any of the tag values change during a scan then the thing metrics will be sent at that scan interval other wise thing metrics will be sent at send_interval_ms irrespective of any tag value change. |
scan_tag_ids | String Array | An array of tag_id defined in source_tags or derived_tags section. This list will be used to send the tag values at each scan defined by scan_interval_ms triggered by change in
monitor_tag_ids. An empty array or null value means all tag values will be sent during the scan interval. It does not affect send interval tags, at send interval all tags will be sent. If specific tags are defined then those tags will be sent during scan interval rest other will be ignored. (Version 4.0.92 onwards supported) |
metric_mappings | metric_mapping Array | An array of metric_mapping object. metric_mapping object defines the mapping between thing metric and source or derived tag. The mapping is kept as a separate object in order
to evolve source_tag and derived_tag definitions independent of thing metric relation. |
source_tag object
protocol_connection | Object | This is an adapter specific JSON object. This will have adapter specific connection properties e.g. Modbus adapter may have properties like ip_address, port while OpcUA adapter may have
server_url, cert_alias properties. |
read_tags | Object Array | An array of read_tag objects. A read_tag object is specific to adapter only the tag_id property is common, it is used for metric mapping and must be unique within a thing_config. E.g. Modbus
adapter properties are device_id, read_count while OPC UA adapter have properties like node_id. These read_tag objects will be polled during each scan and send interval. |
write_tags | Object Array | An array of write_tag objects. A write_tag object is specific to adapter only the tag_id property is common, it is used for writing values to the target device. These tags must be present in the Datonis instruction
json data along with the values to be written. During the instruction execution, writable tag value will be searched in the write_tags section and corresponding adapter address will be written. |
derived_tag object
tag_id | String | The unique tag_id within a thing_config object. This is used further in metric_mapping object to map to thing metric |
expression | String | In case of an expression, you can specify any simple mathematical formula. There are three context arrays available for the expression: latest, prev_scanned and prev_sent. Each context returns
tag values that are computed just now, last scanned (via scan_interval_ms) or last sent (via send_interval_ms). E.g. |
metric_mapping object
metric_id | String | This is metric name of the thing mentioned at thing_config level. Datonis UI location: Home → Thing Templates → {template name} → Metric (Name column) |
tag_id | String | The unique tag_id which is defined either in source_tags or derived_tags section |
type | Enum | Allowed values are number, boolean and string. This type has to match with Datonis metric type. Datonis UI location: Home → Thing Templates → {template name} → Metric (Data Type column) |