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.
https://app1pub.smappee.net/dev/v3/servicelocation/[SERVICELOCATIONID]/sensor/[SENSORID]/consumption
GET
Authorization: Bearer [ACCESS_TOKEN]
[ACCESS_TOKEN] being the access token received from the Get token or Refresh token authentication calls.
Parameter | Type | Description |
---|---|---|
SERVICELOCATIONID | Path Parameter | The actual id of an accessible service location (see Get Servicelocations) |
SENSORID | Path Parameter | The actual id of a sensor that is active at the service location (see Get Servicelocation Info) |
aggregation | Query Parameter | The level of detail and should be one of:
|
from | Query Parameter | The UTC timestamp in milliseconds indicating the beginning of the requested period |
to | Query Parameter | The UTC timestamp in milliseconds indicating the end of the requested period |
fillGaps | Query Parameter | A flag that indicates if the caller wants to fill gaps with empty records. The default is "false" to be backwards compatible. |
http://app1pub.smappee.net/dev/v3/servicelocation/123/sensor/2/consumption?aggregation=1&from=1388534400000&to=1391212800000&fillGaps=true
{ "serviceLocationId": 123, "sensorId": 1, "records": [ { "timestamp": 1388534400000, "value1": 9.0, "value2": 0.0, "temperature": 20.1, "humidity": 68.0, "battery": 89.0 }, ... ] } |
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
The temperature unit in this version is centi degrees Celsius. As an example, the normal human body temperature is returned as 375.0.
The temperature unit in this version is Degrees Celsius. As an example, the normal human body temperature is returned as 37.5.
A query parameter was added to allow the caller to fill gaps with empty records.
|