The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
octopusR is an R package that provides access to the Octopus Energy API. With octopusR, you can easily retrieve data from the Octopus Energy API and use it in your R projects, or Shiny dashboards.
octopusR can be installed from CRAN.
install.packages("octopusR")
If you would like the development version, it can be installed from
GitHub, using the devtools
package:
# Install devtools if needed
if (!require("devtools")) install.packages("devtools")
::install_github("moohan/octopusR") devtools
To use most functions in octopusR, you will need an API key from
Octopus Energy, you can find this on the developer
dashboard. Once you have your API key, you can use
set_api_key()
to interactively input and store the API key
for the session:
library(octopusR)
# Set your API key
set_api_key()
Once you have authenticated with the API, you may also want to set your electric and/or gas meter details.
# Set details for your electricity meter
set_meter_details(meter_type = "electricity")
# Set details for your gas meter
set_meter_details(meter_type = "gas")
You can use the other functions in the package to interact with the
API. For example, you can use the get_consumption()
function to retrieve data about your energy usage:
# Get data about your energy usage
<- get_consumption(meter_type = "elec")
energy_usage #> ℹ Returning 100 rows only as a date range wasn't provided.
#> ✔ Specify a date range with `period_to` and `period_from`.
# View the data
head(energy_usage)
#> # A tibble: 6 × 3
#> consumption interval_start interval_end
#> <dbl> <chr> <chr>
#> 1 0.096 2023-01-15T23:30:00Z 2023-01-16T00:00:00Z
#> 2 0.097 2023-01-15T23:00:00Z 2023-01-15T23:30:00Z
#> 3 0.097 2023-01-15T22:30:00Z 2023-01-15T23:00:00Z
#> 4 0.097 2023-01-15T22:00:00Z 2023-01-15T22:30:00Z
#> 5 0.098 2023-01-15T21:30:00Z 2023-01-15T22:00:00Z
#> 6 0.098 2023-01-15T21:00:00Z 2023-01-15T21:30:00Z
For more information and examples, see the package documentation and the Octopus Energy API documentation.
If you have suggestions for improving octopusR, or if you have found a bug, please open an issue. Contributions in the form of pull requests are also welcome. See the guide to contributing for more details.
Please note that the octopusR project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.
octopusR is licensed under the MIT License. See LICENSE for more information.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.