Skip to content

Python scripts to fetch and store upcoming prices from Octopus

Notifications You must be signed in to change notification settings

nrbrook/agile-prices

Repository files navigation

Octopus Agile price fetcher

These python scripts fetch and store the Octopus Agile prices. store_prices.py is designed to be run as a cron job, and get_prices_from_db.py is designed to be imported by other scripts to fetch the upcoming prices.

First, install the requirements:

pip install -r requirements.txt

Cron scheduling

store_prices.py can be scheduled to fetch the latest prices in crontab (run crontab -e):

05 * * * * cd /path/to/this/dir; /usr/bin/python3 store_prices.py -r <region> -t <agile_tariff> > /path/to/your/log.log

You should replace /path/to/this/dir and /path/to/your/log.log with your local paths, and <region> and <agile_tariff> as follows:

Obtaining prices

Upcoming prices can be fetched from another python script as follows:

import agile_prices

agile_prices.get_prices_from_db(path_to_db, max_num_entries)

Credits

Modified from octopus-agile-pi-prices

About

Python scripts to fetch and store upcoming prices from Octopus

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages