GET /devices/{deviceId}/state

<< Click to Display Table of Contents >>

Navigation:  The API > JSON API > REST Resources > Devices > GET >

GET /devices/{deviceId}/state

Overview

Get last saved states of a device, depending on transmit settings in webinterface

 

Last function states of a single device

Client to Gateway:

Resource Path

HTTP method

/devices/{deviceId}/state

GET

necessary additional call parameters:

parameter

valid values

call option

functionality

deviceId

valid deviceID or friendlyId

4 byte hex valueor friendlyId

required

SenderID of Enocean device, EnOcean modules usually send telegrams with their unique 32-bit Chip ID. In the other case, these are the Base ID of the EnOcean device.

 

response Gateway to Client:

parameter

datatype

value / formatting

description

header

object

{}

 

states

array of objects

[{}]

 

 

deviceId

string

4 byte hex value

SenderID of Enocean device, EnOcean modules usually send telegrams with their unique 32-bit Chip ID. In the other case, these are the Base ID of the EnOcean device.

 

friendlyId

string

 

User-assigned name of EnOcean device. Must be unique.

 

physicalDevice

(optional)

string

 

User-assigned name to group actuators and sensors

 

functions

array of objects

[{}]

 

 

key

string

 

Technical key of function.

 

channel

(optional)

integer

 

Channel if supported by this device.

 

value

float 

 

Value of the function.

 

unit

(optional)

string

[unit]

Unit ISO.

 

meaning

(optional)

string

 

Description of value in English.

 

timestamp

string

yyyy-mm-ddT hh:mm:ss.sss+ hhmm

Timestamp function value was received in case of last state functions.

 

age

integer

 

Age of function value in case of last state functions in milli seconds.

 

Example:

Here we see the actual state of our example device. As you can see, the gateway stored all function states received in different telegrams. Because of that, the age of the functions are varying.

Basic structure of gateway response:

 

http://hostname:api_port/devices/weatherstation/state
 

{
  "header" : {
    "httpStatus" : 200,
    "content" : "state",
    "gateway" : "DC-GW/EO-IP v0.99.0",
    "timestamp" : "2016-05-04T15:15:04.082+0200"
  },
  "state" : {
    "deviceId" : "01842329",
    "friendlyId" : "WeatherStation",
    "functions" : [ {
      "key" : "dawnSensor",
      "value" : 999.00,
      "unit" : "lx",
      "timestamp" : "2016-05-04T15:08:38.381+0200",
      "age" : 385701
    }, {
      "key" : "dayNight",
      "value" : "day",
      "meaning" : "Day",
      "timestamp" : "2016-05-04T15:08:38.381+0200",
      "age" : 385701
    }, {
      "key" : "hemisphere",
      "value" : "north",
      "meaning" : "North",
      "timestamp" : "2016-05-04T15:08:38.185+0200",
      "age" : 385897
    }, {
      "key" : "rainIndication",
      "value" : "noRain",
      "meaning" : "No rain",
      "timestamp" : "2016-05-04T15:08:38.381+0200",
      "age" : 385701
    }, {
      "key" : "sunEast",
      "value" : 1764.71,
      "unit" : "lx",
      "timestamp" : "2016-05-04T15:08:38.185+0200",
      "age" : 385897
    }, {
      "key" : "sunSouth",
      "value" : 2941.18,
      "unit" : "lx",
      "timestamp" : "2016-05-04T15:08:38.185+0200",
      "age" : 385898
    }, {
      "key" : "sunWest",
      "value" : 588.24,
      "unit" : "lx",
      "timestamp" : "2016-05-04T15:08:38.185+0200",
      "age" : 385898
    }, {
      "key" : "temperature",
      "value" : 25.88,
      "unit" : "°C",
      "timestamp" : "2016-05-04T15:08:38.381+0200",
      "age" : 385702
    }, {
      "key" : "windSpeed",
      "value" : 0.00,
      "unit" : "m/s",
      "timestamp" : "2016-05-04T15:08:38.381+0200",
      "age" : 385702
    } ]
  }
}