Return a list of consumption values for half-hour periods for a given meter-point and meter.
Unit of measurement:
Electricity meters: kWh
SMETS1 Secure gas meters: kWh
SMETS2 gas meters: m^3
To return dates properly parsed lubridate is
required. Use the tz parameter to specify a time zone e.g. tz = "UTC",
the default (tz = NULL) will return the dates unparsed, as characters.
get_consumption(
meter_type = c("electricity", "gas"),
mpan_mprn = get_meter_details(meter_type)[["mpan_mprn"]],
serial_number = get_meter_details(meter_type)[["serial_number"]],
api_key = get_api_key(),
period_from = NULL,
period_to = NULL,
tz = NULL,
order_by = c("-period", "period"),
group_by = c("hour", "day", "week", "month", "quarter")
)a tibble of the requested consumption data.
Type of meter-point, electricity or gas
The electricity meter-point's MPAN or gas meter-point’s MPRN.
The meter's serial number.
Your API key. If you are an Octopus Energy customer, you can generate an API key on the developer dashboard.
Show consumption from the given datetime (inclusive). This parameter can be provided on its own.
Show consumption to the given datetime (exclusive).
This parameter also requires providing the period_from parameter
to create a range.
a character string that specifies which time zone to parse the date with. The string must be a time zone that is recognized by the user's OS.
Ordering of results returned. Default is that results are returned in reverse order from latest available figure. Valid values:
period, to give results ordered forward.
-period, (default), to give results ordered from most recent backwards.
Aggregates consumption over a specified time period. A day is considered to start and end at midnight in the server's time zone. The default is that consumption is returned in half-hour periods. Accepted values are:
hour
day
week
month
quarter