Virtual Device Service Example
The Virtual Device Service contains five pre-defined devices.
These devices are created by the Virtual Device Service in Core Metadata when the service initializes. These devices are defined by device profiles that ship with the Virtual Device Service. Each virtual device causes the generation of one to many values of the type specified by the device name. For example, Random-Integer-Device generates integer values: Int8, Int16, Int32, and Int64.
Start the Virtual Device Service
To start the Virtual Device Service, enter the following command:
edgexpert up device-virtual
Configuration Properties
As the devices are pre-defined, they do not require onboarding. You can partially modify it if required. You can edit an existing device in the Edge Xpert Manager UI. For more information, see here.
Each pre-defined device contains similar properties, which are seen in the table below. The Random-Integer-Device is used as an example.
Field | Example Value | Description | Required |
---|---|---|---|
Name | Random-Integer-Device |
The unique name used to identify device | Required |
Description | Example of Device Virtual |
Any additional information to help identify the device | Optional |
Labels | device-virtual-example |
Any additional information to help identify the device | Optional |
Protocol | virtual |
Communication protocol name | Required |
Protocol Property | other |
Allows protocol specific information to be added | Required |
Device Profile | Random-Integer-Device |
The name of the device profile used for this device | Required |
Device Service | device-virtual |
The name of the appropriate device service | Required |
Auto Events | Interval: 15s OnChange: false Resources: Int8 , Int16 , Int32 , Int64 |
Automated events to retrieve the data at specific frequencies Note: If OnChange is set to true, values will only be pushed if a change in value has occurred during the specified interval. If set to false, values will be sent on the specified interval regardless of if there has been a change |
Optional |
Device Data Flow
Once the device is onboarded to Edge Xpert, data flow between the Device Service and the connected device can be verified in a number of ways.
The Edge Xpert Manager UI supports Read and Write functionality for each device. Readings can also be viewed and queried within the Edge Xpert Manager UI Data Center.
Alternatively, you can read and write data with cURL commands or through REST API applications, such as Postman.
Info
If Edge Xpert is running in secure mode, you will need to replace localhost in the URL with the IP address for the service. See CLI Service Ports for details.
Both the GET and PUT commands can be made to the following address:
http://localhost:59882/api/v2/device/name/{deviceName}/{commandName}
curl http://localhost:59882/api/v2/device/name/Random-Integer-Device/Int16
For more information on the GET and PUT commands, see the Core Command Microservice.
Any data collected by the Device Service can then be processed like all other Edge Xpert sensor data. The data readings can be exported for data processing in a number of other applications and services. See the Supporting Services and Application Services documentation for more details.