Wrapper for communicating with the Octopus Energy API
Project description
GitHub: github.com/euanacampbell/octopus_energy_api
PyPi: pypi.org/project/octopus-energy-api
Installation
pip install octopus-energy-api
Import
from octopus_energy_api import oe_api
Usage
Two ways of creating an API instance.
Load access details in manually - Can be found using this fantastic tutorial by Guy Lipman guylipman.medium.com.
from octopus_energy_api import oe_api
account_number = ""
api_key = ""
mpan = ""
serial_number = ""
energy_api = oe_api(account_number, api_key, mpan=mpan, serial_number=serial_number)
Get mpan and serial numbers from account number + api key. (currently only works for single property accounts)
from octopus_energy_api import oe_api
api_key = "value"
account_number = "value"
energy_api = oe_api(account_number, api_key)
Account Details
energy_api.account_details()
Consumption
Getting all consumption data.
today = datetime.date.today() # setting end date to today
start = today.replace(day=1) # setting start date to the beginning of the month
energy_api.consumption(start, today)
Getting calculated consumption data - total, mean, and median.
today = datetime.date.today() # setting end date to today
start = today.replace(day=1) # setting start date to the beginning of the month
energy_api.consumption_total(start, today)
energy_api.consumption_mean(start, today)
energy_api.consumption_median(start, today)
Price of consumption.
today = datetime.today()
start = today - timedelta(days=300)
electric_rate = 2.73
energy_api.consumption_cost(start, today, electric_rate)
Products
energy_api.products()
Meter Information
energy_api.meter_point()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
octopus_energy_api-0.7.tar.gz
(4.4 kB
view hashes)
Built Distribution
Close
Hashes for octopus_energy_api-0.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ec1a47e9577d85a26b63e0a15f1f488b7998e019727c911873b088cb19094e5 |
|
MD5 | 3b949cecefd52ca6f0d4c1f6f053feeb |
|
BLAKE2b-256 | f0c754e786db35aa70391afbb324e1d979138f59a6997bf91c5c190259bcadf3 |