Skip to main content

Interface to the Amber Electric API, allowing you to download current and forecast price, as well as download your historic usage.

Project description

Amber - An entirely new way to buy electricity

Amber is an Australian-based electricity retailer that pass through the real-time wholesale price of energy.

Because of Amber's wholesale power prices, you can save hundreds of dollars a year by automating high power devices like air-conditioners, heat pumps and pool pumps.

This Python library provides an interface to the API, allowing you to react to current and forecast prices, as well as download your historic usage.

Details

  • API version: 1.0
  • Package version: 1.0.0

Requirements

Python >= 3.6

Getting started

Not an Amber customer yet? Join here: https://join.amber.com.au/signup

Once your account has been created, you need to create an API token

Installation

pip install

If the python package is hosted on a repository, you can install directly using:

pip install amberelectric

Usage

Setup and confirguration

# Import the library
import amberelectric
from amberelectric.api import amber_api

# These are just for demo purposes...
from pprint import pprint
from datetime import date

# Insert the API token you created at https://app.amber.com.au/developers
configuration = amberelectric.Configuration(
    access_token = 'psk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
)

# Create an API instance
api = amber_api.AmberApi.create(configuration)

Fetching Sites

All the interesting functions require a site id, so find one of those first - they can be identified by the National Metering Identifier (NMI)

try:
    sites = api.get_sites()
except amberelectric.ApiException as e:
    print("Exception: %s\n" % e)

This will return an List of Sites

Fetching Prices

The API allows you to fetch previous, current and forecast prices by day.

If no start_date or end_date is supplied, it default to the current day.

Note: If duration is 30, there will be 48 intervals per channel. A duration of 5 returns 288 intervals.

site_id = sites[0].id
try:
    start_date = date(2021, 6, 1)
    end_date = date(2021, 6, 2)
    range = api.get_prices(site_id, start_date=start_date, end_date=end_date)
    today = api.get_prices(site_id)
except amberelectric.ApiException as e:
    print("Exception: %s\n" % e)

You can also just ask for the current price

site_id = sites[0].id
try:
    current = api.get_current_prices(site_id)
except amberelectric.ApiException as e:
    print("Exception: %s\n" % e)

and the current price plus some number of previous and next intervals

You can also just ask for the current price

site_id = sites[0].id
try:
    current = api.get_current_price(site_id, next=4)
    # returns the current interval and the next 4 forecast intervasl
except amberelectric.ApiException as e:
    print("Exception: %s\n" % e)

Usage

You can request your usage for a given day.

site_id = sites[0].id
try:
    usage = api.get_usage(site_id, date(2021, 6, 1), date(2021, 6, 1))
except amberelectric.ApiException as e:
    print("Exception: %s\n" % e)

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

amberelectric-1.0.1.tar.gz (34.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

amberelectric-1.0.1-py3-none-any.whl (35.4 kB view details)

Uploaded Python 3

File details

Details for the file amberelectric-1.0.1.tar.gz.

File metadata

  • Download URL: amberelectric-1.0.1.tar.gz
  • Upload date:
  • Size: 34.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.2

File hashes

Hashes for amberelectric-1.0.1.tar.gz
Algorithm Hash digest
SHA256 efee6ed11d30346bdf20a5660c719ff7d92098d489cc15657c2814538b4b519f
MD5 bd3053044911b1e433b8ff3276a08153
BLAKE2b-256 86fc15f6ea908a4f5e1e1e799182e8cd896959015c53775c8ac4e5a3e00df88e

See more details on using hashes here.

File details

Details for the file amberelectric-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: amberelectric-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 35.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.2

File hashes

Hashes for amberelectric-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 71dd46f0e29d474ed91155fce12bdf5bf9d6237f227aac931d52ed0793860b4a
MD5 653a02dc5bee3bf553fe9cd75268dbbe
BLAKE2b-256 c9d1a99a29c743cd2e74175ddd78dc778c6a85b6b93284e1297ea9b3f92e09e2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page