Skip to content

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 first 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. These can be partially modified by the user if desired. Edits to existing devices can be made in the Edge Xpert Manager UI. Further information on this can be found 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.

Both the GET and PUT commands can be made to the following address:

http://localhost:59900/api/v2/device/name/{deviceName}/{commandName}
Using the example above, this could be:
http://localhost:59900/api/v2/device/name/Random-Integer-Device/Int16

For more information on the GET and PUT commands, see the Core Command Microservice.

Note

59900 is the default port for the Virtual device service

Any data collected by the Device Service can then be treated 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.

Back to top