Get Switch Consumption
Description
Returns the consumption of energy on a specific switch 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]/switch/[MONITORID]/consumption
HTTP method
GET
HTTP header
Authorization: Bearer [ACCESS_TOKEN]
 [ACCESS_TOKEN] being the access token received from the Get token or Refresh token authentication calls.
Parameters
Parameter | Type | Description |
---|---|---|
SERVICELOCATIONID | Path Parameter | The actual id of an accessible service location (see Get Servicelocations) |
MONITORID | Path Parameter | The actual id of a switch that is active at the service location (see Get Servicelocation Info where a switch is called an actuator) |
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 |
Example
http://app1pub.smappee.net/dev/v3/servicelocation/123/switch/2/consumption?aggregation=1&from=1388534400000&to=1391212800000
Result
{
"serviceLocationId": 123,
"monitorId": 1,
"records": [
{
"timestamp": 1388534400000,
"active": 9.0,
"reactive": 0.0,
},
...
]
}
Versioning
This was introduced in version 2 of the API.