Skip to main content

Unofficial API for Amber Electric

Project description

pyAmberElectric

Make it easier to use Amber's newer API that uses AWS Cognito for authentication.

Specify your login creds, and optionally how long to leave between refeshing the data in seconds. The default is equal to 5 minutes.

You can get the entire response from Amber with the json property, or cut out the middleman and get specific values like currentPrice. Data is stored locally so feel free to grab the properties without hammering Amber's servers or being stuck with stale data.

How-to

Install with pip3 install pyAmberElectric as you might expect.

from pyAmberElectric import pyAmberElectric
Amber = pyAmberElectric(username='yourEmail', password='yourPassword', maxAge=300)

#array of your meter prices, usually [ centsperkwh, solarfeedin ]
Amber.currentPrice

#the complete raw json data
Amber.json

print("Prices are currently ", Amber.currentValue)

The Deets

Renewing auth and data

The authentication token will be automatically renewed when needed, normally lasting an hour. You can call auth() to manually renew if required.

If needed, all known data is requested at once. When the local data is older than the maxAge, the data is refreshed. You can also call update() to manually request new data. Amber's data doesn't change more often than every 5 minutes at most so no need to hammer it.

Avaliable Props

json

Returns the full json object returned by Amber. Contains all info avaliable in the app/website.

currentPrice

Returns an array of your current prices in cents.

currentRenewable

Returns an array of the current percentage of renewables in the grid.

currentValue

Returns an array of the current qualative value of the price. Can be 'BAD', 'NEUTRAL' or 'GOOD'.

periodCost

Returns the total cost for the last 30 days in cents.

periodUsage

Returns the total usage for the last 30 days in Kwh.

periodRenewable

Returns the average percentage of renewables in the grid for the last 30 days.

Secret Methods

You shouldn't need to call these methods but they are there if you really want/need them.

auth()

Renew the authentication token.

update()

Refresh the data from Amber.

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

pyamberelectric-0.0.3.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

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

pyamberelectric-0.0.3-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file pyamberelectric-0.0.3.tar.gz.

File metadata

  • Download URL: pyamberelectric-0.0.3.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.8

File hashes

Hashes for pyamberelectric-0.0.3.tar.gz
Algorithm Hash digest
SHA256 0e1da57fe7fce5897aa3f5e83b26d2061545cff7edc3324bdfd5f22a6637a65c
MD5 0a44edff3c50cf25b4b074f62e3bee6e
BLAKE2b-256 bdab4b4f868a3d64cdbfe634e9419fbf903f70ccfd4fc39ea8a8ff9becea0b63

See more details on using hashes here.

File details

Details for the file pyamberelectric-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for pyamberelectric-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1de50f3fe421dc6c9aa8912d1573d9081fc10ff62ee29dbfa058603e307ef87a
MD5 873478ec36169bea46d2cbc47f5dd7e8
BLAKE2b-256 35e3a5cc20b823ff515f9d9c02a35530adddda3e5ddf6c1f29bb76ccbd11b437

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