Skip to main content

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/sign-up

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.py

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)

Metadata

Release files for amberelectric.py 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for amberelectric.py 1.0.0
File Size Uploaded Provenance Actions
amberelectric.py-1.0.0.tar.gz 34.0 kB Without provenance Details for amberelectric.py-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for amberelectric.py 1.0.0
File Interpreter ABI Platform Actions
amberelectric.py-1.0.0-py3-none-any.whl Python 3 none any Details for amberelectric.py-1.0.0-py3-none-any.whl

Total release size: 69.4 kB

Release files / amberelectric.py-1.0.0.tar.gz

Download URL amberelectric.py-1.0.0.tar.gz
Size 34.0 kB
Tags Source
SHA-256 checksum
How to use checksums
071c9eacff8f432813667abf70196c82b45434caf0905cd73558beb1e03f5903
BLAKE2b-256 checksum
How to use checksums
41e97932f83e16727f48c1871889c20087a20ca4e3b99bebc40eac3f24a83ea8
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / amberelectric.py-1.0.0-py3-none-any.whl

Download URL amberelectric.py-1.0.0-py3-none-any.whl
Size 35.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dca1e872a8fd1df305a3d87825b03d6c1f6499b9fa52c780966370ce79f1641f
BLAKE2b-256 checksum
How to use checksums
b6a3b4200a6c17cff178a6d9b135bb144a0e514aaa5ea6d90de540a5a8051135
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for amberelectric.py 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page