G1 Sensor
Last updated
Was this helpful?
Last updated
Was this helpful?
Device and command supported
Start device service
Examples
Reference
Device Services (DS) are the edge connectors interacting with the devices or IoT objects. Device services may service one or a number of devices, including sensors, actuators, and so forth.
Launch adv-coldchain with UART port parameter after EdgeX starts.
Example :
[For Linux] sudo ./adv-coldchain “/dev/ttyUSB0”
[For Windows] adv_coldchain.exe "COM8"
The coldchain micro service will connect to EdgeX and show service and gateway version.
EdgeX is running with IP 172.16.8.87 in this case.
There are several devices in coldchain, one is ds_coldchain for gateway controller and others are pre-defined sensors.
ds_coldchain
5DCB898B7489
5DCB898B754A
ColdChain device commands
version (GET)
gateway_version (GET)
ColdChain sensor commands (for each sensor)
sensor_uid(GET)
sensor_count (GET)
sensor_time (GET)
sensor_temperature (GET)
sensor_humidity (GET)
sensor_externalvoltage (GET)
sensor_internalvoltage (GET)
sensor_fallcount (GET)
sensor_flag (GET)
sensor_crc (GET)
sensor_rssi (GET)
sensor_snr (GET)
sensor_rawdata(GET)
Note: Voltage value is in mV
EdgeX Device service uses two options to specify the device and commands. One is by ID (generated by database) and other one is by name.
For the one by ID, EdgeX provides the following REST API to get device and command ID
Note: localhost is replaced by the physical device IP.
In the above example, for ds_coldchain device
deviceId is 5cfdc9779f8fc2000190e8c0 and
version’s commandId is 5cfdc9779f8fc2000190e8bc.
Replace "edgex-core-command" with physical device IP (for example 172.16.8.87) and use web browser to send the following command to get ds_coldchain’s version.
Before starting the device service, it needs to set the related IP in configuration.toml file.
Step 1
Add DeviceList block with sensor ID 5DCB898B7E85 in configuration.toml
Step 2
Create or copy exist [sensorID].yaml and modify name and model to [sensorID] and then save as [sensorID].yaml.
Launch adv-coldchain with uart port parameter after EdgeX starts. i.e.,
The coldchain micro service will connect to EdgeX and show the following information as below
sensor devices and ds_coldchain’s gateway version.
Get sensor last update time.
URL
or
Method
Get
Success Response:
Content
Error Response:
Content: service unavailable
Example
Get sensor update time from sensor 5DCB898B7489 by device ID
Get sensor update time from 5DCB898B7489 by device Name
Device service configuration: https://edgex-api-advantech.gitbook.io/edgex-api-doc/device-service-apis/device-service-configuration
Device service programming: https://edgex-api-advantech.gitbook.io/edgex-api-doc/device-service-apis/edgex-api-