EdgeX-API doc
  • EdgeX Foundry Background
  • Getting Started
    • Install
    • UI Console
      • V1.0
      • V1.1
    • Experiencing EdgeX
  • Edge to Cloud
    • Azure
    • AWS
    • Aliyun
  • Edge to Edge
    • MQTT Export Service
    • MQTT Import Service
    • Grafana Dashboard Connection
  • Industrial SDK Setup
  • Device Connection
    • Configuration
    • Programming Basics
    • EdgeX Version
    • Platform
      • System Information
      • RF
    • Cold Chain
      • G1 Sensor
      • Gateway
    • Printer
    • Scanner SDK
    • Battery
    • IP Camera
    • SNMP
    • Modbus
    • Medical Cart
  • Advanced Services APIs
    • EdgeX Service Layers
    • Core Data Service APIs
    • Meta Data Service APIs
    • Command Service APIs
    • Alarm Service APIs
  • Edge AI
    • Face Detection
    • Facial Recognition
  • Edge to WISE-PaaS
    • Smart Pump Station Solution
    • Cloud Cold Chain Solution
    • Integration with WISE-PaaS
  • Edge to Cloud(for Delhi only)
    • Azure
    • AWS
  • Retail Utility
    • OPOS Manager
  • Medical Utility
    • AMiS Link
  • Vertical Utility
    • Self-Diagnostics
    • System Diagnostics
    • DeviceChecking / Kiosk
    • DeviceChecking / Server
    • Device Diagnostic Dashboard
    • Windows Lockdown/ Kiosk
    • Retail System Manager
    • Scanner Utility
  • Application Cases
    • Smart Warehouse
    • Smart Kiosk
    • Demo Video
Powered by GitBook
On this page
  • Contents
  • Device and Command Supported
  • Devices
  • Commands
  • Get Device and Command API
  • Start Device Service
  • Add Device Sensor
  • Examples
  • Sensor Time
  • Reference

Was this helpful?

  1. Device Connection
  2. Cold Chain

G1 Sensor

PreviousCold ChainNextGateway

Last updated 3 years ago

Was this helpful?

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

Device service configuration:

Device service programming:

https://edgex-api-advantech.gitbook.io/edgex-api-doc/device-service-apis/device-service-configuration
https://edgex-api-advantech.gitbook.io/edgex-api-doc/device-service-apis/edgex-api-