Home Assistant Client library for Carbon Intensity API
Project description
carbonintensity
Simple Carbon Intensity UK API Library
The purpose of this library is to retrieve information from Carbon Intensity UK
The client connects asynchrnously to the API for retrieving information about the current level of CO2 generating energy in the current period.
It uses aiohttp to communicate with the API asynchrnously. This decision has been based mainly on the premise that the library will be used in the context of Home Assistant integration.
In addition it calculates when is the next 24 hours lowest level comparing values of the CO2 forecast levels.
Example
Retrieve regional and national information based on postcode SW1 for the next 24 hours starting now:
client = Client("SW1")
response = await client.async_get_data()
data = response["data"]
Note: Time in UTC
Data format
An example of the function output can be found below:
{
"data":
{
"current_period_from": "2020-05-20T10:00+00:00",
"current_period_to": "2020-05-20T10:30+00:00",
"current_period_forecast":300,
"current_period_index": "high",
"current_period_national_forecast":230,
"current_period_national_index": "moderate",
"lowest_period_from":"2020-05-21T14:00+00:00",
"lowest_period_to":"2020-05-21T14:30+00:00",
"lowest_period_forecast": 168,
"lowest_period_index": "moderate",
"postcode": "SW1"
}
}
Install carbonintensity
python3 -m pip install -U carbonintensity
Licenses
This work is based on the following:
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 Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file carbonintensity-0.3.0.tar.gz.
File metadata
- Download URL: carbonintensity-0.3.0.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74915cfb458c9fa92407203118bab21e8e9a6832c6e2878d7a4dbdfa7395f0a3
|
|
| MD5 |
a14961dc03bc3d37a6f08dbbdf43479b
|
|
| BLAKE2b-256 |
ee577387e27baae551e51e0f709096868eaf35505b915ac57bad48b1a32255ac
|
File details
Details for the file carbonintensity-0.3.0-py3.9.egg.
File metadata
- Download URL: carbonintensity-0.3.0-py3.9.egg
- Upload date:
- Size: 5.3 kB
- Tags: Egg
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d569625bab48e290612a977fb4d1fd3ef09118531acf1ad0b436f0d0824f7b5
|
|
| MD5 |
7cbd09b05e9179602e600de0675222ef
|
|
| BLAKE2b-256 |
066b9ad9b75e15b13ca92cad0629eedfa0ad0d00f267a44f0ac14e32cc9bf1cb
|
File details
Details for the file carbonintensity-0.3.0-py3-none-any.whl.
File metadata
- Download URL: carbonintensity-0.3.0-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
320dc7f4ff734a0af6643cbb9880926daf573788ed49725ed856f4fb7f649256
|
|
| MD5 |
729a4e138d11626c1158d2731b2b5243
|
|
| BLAKE2b-256 |
ad3102623db10f8db76b5757936e126fa643d1dc5d06e8dde37115b2c702d530
|