Code Monkey home page Code Monkey logo

octopus_energy_api's Introduction

made-with-python GitHub license

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()

octopus_energy_api's People

Contributors

unplaceable avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.