Configure an adapter or EDS with commands
- Last UpdatedFeb 28, 2025
- 3 minute read
Use EdgeCmd utility to configure an adapter or EDS using only commands or by pointing to JSON files. For more information, see Configure an adapter or EDS with .json Files.
Note: The examples in this topic use the default port number 5590. If you specified a different port number for your adapter or EDS, you need to add it in the command. For example:
edgecmd -port 5591 <RestOfTheCommand>
Note: If a command contains slashes, you must add escape characters as follows:
In Windows, add a second slash.
Example: TestUser\OilCompany becomes TestUser\\OilCompany
In Linux, add three additional slashes.
Example: TestUser\OilCompany becomes TestUser\\\\OilCompany
Change all values of a facet
Complete the following steps to change all values of a facet:
-
Access EdgeCmd utility through the command line.
-
Type the set keyword.
-
Add the <facetName> and <componentId>, replacing both with their respective values.
-
Add all key-value pairs. Then, press Enter.
edgecmd set <facetName> -cid <componentId> -<Key1> <Value1> -<Key2> <Value2> -<Key3> <Value3>
Example: Change all values in the Logging facet of the OpcUa1 component:
edgecmd set Logging -cid OpcUa1 -LogLevel Warning -LogFileSizeLimitBytes 5000 -LogFileCountLimit 30
Linux only: Add or change data selection items containing single quotes
For the following TextParser-based adapters, you must wrap the value of data selection items that contain single quotes within single quotes and escape those with a backslash:
-
PI Adapter for Structured Data Files
-
PI Adapter for MQTT
-
PI Adapter for Azure Event Hubs
Instead of $['Value1'], type '$['\''Value1'\'']'.
Example:
edgecmd add dataselection -cid MQTT1 -timefield '$['\''Timestamp'\'']' -valuefield '$['\''Value'\'']'`
Configure key-value pairs in a facet
Complete the following steps to configure not all but any number of valid key-value pairs in a facet:
-
Access EdgeCmd utility through the command line.
-
Type the edit keyword and the <facetName>.
-
Add the <facetName>and <componentId>, replacing both with their respective values.
-
Add the key-value pairs you want to configure. Then, press Enter.
edgecmd edit <facetName> -cid <componentId> -<Key1> <Value1>
Example: Configure the LogFileCountLimit key in the Logging facet of the Modbus1 component:
edgecmd edit Logging -cid Modbus1 -LogFileCountLimit 15
Add an entry to a collection configuration
An entry in a collection configuration is, for example, a complete facet of a configured component. Complete the following steps to add an entry to a collection configuration:
-
Access EdgeCmd utility through the command line.
-
Type the add keyword and the <facetName>.
-
Add the <componentId>, replacing it with the ID of the component.
-
Add the key-value pairs. Then, press Enter.
edgecmd add <facetName> -cid <componentId> -<Key1> <Value1> -<Key2> <Value2>
Example: Add the 'Schedules' facet to the 'Modbus1' component:
edgecmd add Schedules -cid Modbus1 -Id 2 -Period 00:00:30
Configure payload port
EdgeCmd utility commands may include up to two port numbers. The first specified port number is always designated for the EdgeCmd application. The second port number is designated for the payload of the adapter or EDS.
Complete the following steps to edit the port number of the payload:
-
Access EdgeCmd utility through the command line.
-
Type the edit and datasource keywords.
-
Add the first <port>, replacing it with the port number of the EdgeCmd application. The default is 5590.
-
Add the <componentId>, replacing it with the ID of the component.
-
Add the second <port>, replacing it with the port number of the payload. Then, press Enter.
edgecmd edit datasource -port 5590 -cid Mqtt1 -port 1885
Note:
If a payload port number is configured for a component and you specify only one port number in the data source command, you will receive the following error message: Invalid arguments. Input arguments are required.
If you specify more than two port numbers, you will receive the following error message: Duplicate optional argument: -port