Skip to main content

carbonintensity

Maintained BuyMeCoffee

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:

Metadata

Release files for carbonintensity 0.3.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 carbonintensity 0.3.0
File Size Uploaded
carbonintensity-0.3.0.tar.gz 3.5 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for carbonintensity 0.3.0
File Interpreter ABI Platform
carbonintensity-0.3.0-py3.9.egg Legacy Egg format - - Details
carbonintensity-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.2 kB

Release files / carbonintensity-0.3.0.tar.gz

Download URL carbonintensity-0.3.0.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
74915cfb458c9fa92407203118bab21e8e9a6832c6e2878d7a4dbdfa7395f0a3
BLAKE2b-256 checksum
How to use checksums
ee577387e27baae551e51e0f709096868eaf35505b915ac57bad48b1a32255ac
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / carbonintensity-0.3.0-py3.9.egg

Download URL carbonintensity-0.3.0-py3.9.egg
Size 5.3 kB
Tags Egg
SHA-256 checksum
How to use checksums
7d569625bab48e290612a977fb4d1fd3ef09118531acf1ad0b436f0d0824f7b5
BLAKE2b-256 checksum
How to use checksums
066b9ad9b75e15b13ca92cad0629eedfa0ad0d00f267a44f0ac14e32cc9bf1cb
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / carbonintensity-0.3.0-py3-none-any.whl

Download URL carbonintensity-0.3.0-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
320dc7f4ff734a0af6643cbb9880926daf573788ed49725ed856f4fb7f649256
BLAKE2b-256 checksum
How to use checksums
ad3102623db10f8db76b5757936e126fa643d1dc5d06e8dde37115b2c702d530
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.3.0 This release

3 release files

0.2.0

3 release files

0.1.0

2 release files

0.0.0

1 release file

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