Skip to content

Octopus Go

Octopus Go is a tariff for EV owners who don't have an EV or charger that can be controlled in a smart way.

Configuration

  • action_when_cheap is your function that is called when the half hourly period is among the cheapest
  • action_when_expensive is your function that is called when the half hourly period is more expensive than the cheapest
  • pricing_strategy is a custom class you can pass in to act on prices in a more complex way (this is covered in custom pricing strategies)
  • api_key a secret key that gives the script access to fetch your most recent tariff (do not push this to git or share with anyone)
  • account_number your account number for a supported supplier and tariff
How do I get my account number & API key?

Go to octopus.energy and sign in, then follow these steps after clicking the menu button on the home page.

clicking the menu navigation in the top left, then navigating to my account image showing that you should copy the account number from the field under your name, and then selecting personal details under it to get to next step after clicking personal details, you should scroll down to developer settings and then click API access then copy the API key that is in the field, this should read like some nonsense characters

A best practice is to place these in a .env file, and bring them in with python-dotenv, be sure to put .env in a .gitignore file.

How often are my actions called

The actions happen 3 times during the entire day:

  • 00:00am when prices are expensive
  • 00:30am when prices are cheap
  • 05:30am when prices are expensive

There is a 10 minute grace period on an action missing your current time from when you begin the schedule initially.

Usage

# main.py
from energy_tariff_scheduler import runner, Price

def action_when_cheap(price: Price):
    print("cheap", price.value)

def action_when_expensive(price: Price)
    print("expensive", price.value)

runner.run_octopus_go_tariff_schedule(
  prices_to_include=12,
  action_when_cheap=action_when_cheap,
  action_when_expensive=action_when_expensive,
  api_key="YOUR-API-KEY",
  account_number="YOUR-ACCOUNT-NUMBER",
  is_intelligent=False
)