Interfaces with Barry Energy's API
Project description
python-barry-energy - ⚡
This simple python package is an interface to Barry Energy's API
Please note that this lib is unofficial and NOT related to Barry Energy.
How to use
How to install ?
Simply type pip3 install python-barry-energy
How to run
You can use the Barry Energy API to get the SPOT prices of any given period in the past or near future (if settlements have been made).
For example, in order to get actual France's spot prices, you may do the following:
>>> import datetime
>>> from barry_energy import BarryEnergyAPI, PriceArea
>>>
>>> barry = BarryEnergyAPI('my-super-secret-token')
>>> now = datetime.datetime.now()
>>> barry.spotPrices(PriceArea.FR_EPEX_SPOT_FR, now, now + datetime.timedelta(hours=2)))
{datetime.datetime(2021, 2, 17, 20, 0, tzinfo=datetime.timezone.utc): 0.04837,
datetime.datetime(2021, 2, 17, 21, 0, tzinfo=datetime.timezone.utc): 0.04758,
datetime.datetime(2021, 2, 17, 22, 0, tzinfo=datetime.timezone.utc): 0.04499}
>>>
>>> barry.meteringPointConsumption(barry.yesterday_start, barry.yesterday_end)
{'1234567891023': {datetime.datetime(2021, 3, 1, 23, 0, tzinfo=datetime.timezone.utc): 0.337, ....}}
The dates indicate the start of the delivery period. It is assumed that each delivery period is one hour long. In our case, prices are in €/kWh
The values returned by the API should be the same values than EPEX spot
More information
Price Areas
If your electricity meter is located in France, use PriceArea.FR_EPEX_SPOT_FR
If you're in Danemark, use PriceArea.DK_NORDPOOL_SPOT_DK1
or PriceArea.DK_NORDPOOL_SPOT_DK2
according to wikipedia
How to get a token
You can get a token from the APP in the Modules / Barry API
menu.
Doc
class BarryEnergyAPI(builtins.object)
| BarryEnergyAPI(api_token: str)
|
| Methods defined here:
|
| __init__(self, api_token: str)
| Initialize self. See help(type(self)) for accurate signature.
|
| meteringPointConsumption(self, date_start: datetime.datetime, date_end: datetime.datetime, mpid=None)
| Returns the consumption (in kWh per hour) during date_start and date_end. If mpid is None,
| returns the consumption of the MPID/MPAN. Else returns the consumption of the specified mpid
|
| spotPrices(self, market_zone: barry_energy.PriceArea, date_start: datetime.datetime, date_end: datetime.datetime)
| Returns the hourly spot price on market_zone for the
| given dates.
| Warning: dates are assumed UTC
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| meteringPoints
| Returns the metering points linked to the contract
|
| one_day
| Returns a timedelta of 24 hours
|
| yesterday_end
| Returns the date of the end of yesterday
|
| yesterday_start
| Returns the date of the start of yesterday
|
| ----------------------------------------------------------------------
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
Built Distribution
File details
Details for the file python-barry-energy-0.0.3.tar.gz
.
File metadata
- Download URL: python-barry-energy-0.0.3.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba5b6174759068779b3fa8575c2b7eca98653eb5e079dd753ea7f7eaf91f0595 |
|
MD5 | c37cdd1a10506574d855baf19652764c |
|
BLAKE2b-256 | 283061a3714f1a207b2a00c13ce0d8735f36647a651d06cbbb964f4d7aceb03d |
File details
Details for the file python_barry_energy-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: python_barry_energy-0.0.3-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e64c0e4f76fa20fb66ef22e6408bd72829a02c83841e1cffb023eae2d69b177 |
|
MD5 | 95d5e118865780754e653f0860a0eb29 |
|
BLAKE2b-256 | 42d1f9d54b0f86fd1b2bb61e4d730bf9fa20710a7b9b62908caa9cb9b133b0d6 |