Get Sensor Consumption

Description

Returns the consumption of energy on a specific sensor that is active on a specific service location during a specified range of time. The call support different aggregation levels to obtain different levels of details.

A range of time is always interpreted as a closed-open interval, meaning that the start is inclusive, the end is exclusive. So requesting all 5min intervals for e.g. Oct 10 2020 (timezone Europe/Brussels) is done with the following range: [1602280800000, 1602367200000) where 1602280800000 is the UTC timestamp for Oct 10th 2020 and 1602367200000 is the UTC timestamp for Oct 11th 2020 (both timezone Europe/Brussels). The interval with timestamp 1602280800000 is already part of the next day so you do not want that. Using an open interval avoid that you always have to take one step back and subtract 5mins from 1602280800000. You can simply decide on the start of your interval and add the duration you are interested in and we will do the rest.

Resource URL

https://app1pub.smappee.net/dev/v3/servicelocation/[SERVICELOCATIONID]/sensor/[SENSORID]/consumption

HTTP method

GET

HTTP header

Authorization: Bearer [ACCESS_TOKEN]

(info) [ACCESS_TOKEN] being the access token received from the Get token or Refresh token authentication calls.

Parameters

ParameterTypeDescription
SERVICELOCATIONIDPath ParameterThe actual id of an accessible service location (see Get Servicelocations)
SENSORIDPath ParameterThe actual id of a sensor that is active at the service location (see Get Servicelocation Info)
aggregationQuery Parameter

The level of detail and should be one of:

  • 1 to obtain the 5 minute data (most detailed level)
  • 2 to obtain hourly values
  • 3 to obtain daily values
  • 4 to obtain monthly values
  • 5 to obtain quarterly values
fromQuery ParameterThe UTC timestamp in milliseconds indicating the beginning of the requested period
toQuery ParameterThe UTC timestamp in milliseconds indicating the end of the requested period
fillGapsQuery ParameterA flag that indicates if the caller wants to fill gaps with empty records. The default is "false" to be backwards compatible.

Example

http://app1pub.smappee.net/dev/v3/servicelocation/123/sensor/2/consumption?aggregation=1&from=1388534400000&to=1391212800000&fillGaps=true

  • SERVICELOCATIONID = 123
  • SENSORID = 2

Result

Output

For ALL the values we use the "." (dot) notation to show the precision with the amount of fraction digits.
1.00 means 1 with a precision of 2 decimals.
. is the decimal point, not the thousand separator. (As sometimes confused in certain countries)


servicelocationId: The id of the serviceloation
sensorId: the id of the sensor

records JSONArray, contains the following JSONObjects

  • timestamp: miliseconds since epoch
  • value1: pulses measured on first input (please also see the Pulse Per Unit (PPU) setting that can be found via Get Servicelocation Info)
    • To get correct values you need to devide value with PPU
  • value2: pulses measured on the second input 
    • To get correct values you need to devide value with PPU
  • value3: pulses measured on the third input (only applicable for the Input Module as it has 4 inputs)
  • value4: pulses measured on the fourth input (only applicable for the Input Module as it has 4 inputs) 
  • temperature: Measured Temperature in °C (only Applicable for Smappee Gas & Water, Input Module does not measure this)
  • humidity: Measured humidity in percentage (only Applicable for Smappee Gas & Water, Input Module does not measure this)
  • battery: Measured battery in percentage (only Applicable for Smappee Gas & Water, Input Module does not measure this)

Versioning

Version 1 (v1)

The temperature unit in this version is centi degrees Celsius. As an example, the normal human body temperature is returned as 375.0.

Version 2 (v2)

The temperature unit in this version is Degrees Celsius. As an example, the normal human body temperature is returned as 37.5.

Version 3 (v3)

A query parameter was added to allow the caller to fill gaps with empty records.