G1 Sensor

Contents

  • Device and command supported

  • Start device service

  • Examples

  • Reference

Device and Command Supported

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.

Devices

There are several devices in coldchain, one is ds_coldchain for gateway controller and others are pre-defined sensors.

  • ds_coldchain

  • 5DCB898B7489

  • 5DCB898B754A

Commands

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

Get Device and Command API

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

http://localhost:48082/api/v1/device

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.

http://172.16.8.87:48082/api/v1/device/5cfdc9779f8fc2000190e8c0/command/5cfdc9779f8fc2000190e8bc

Start Device Service

Before starting the device service, it needs to set the related IP in configuration.toml file.

Add Device Sensor

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.,

sudo ./adv-coldchain “/dev/ttyUSB0”

The coldchain micro service will connect to EdgeX and show the following information as below

  • sensor devices and ds_coldchain’s gateway version.

Examples

Sensor Time

Get sensor last update time.

URL

http://localhost:48082/api/v1/device/{deviceId}/command/{commandId}

or

http://localhost:49986/api/v1/device/name/{deviceName}/sensor_time

Method

  • Get

  • Success Response:

Code: 200

Content

  • Error Response:

Code: 503

Content: service unavailable

Example

Get sensor update time from sensor 5DCB898B7489 by device ID

http://172.16.8.87:48082/api/v1/device/5cff70239f8fc200013d87b6/command/5cff70239f8fc200013d8787

Get sensor update time from 5DCB898B7489 by device Name

http://172.16.8.87:49986/api/v1/device/name/5DCB898B7489/sensor_time

Reference

Last updated