Skip to main content

Home Assistant Client library for Carbon Intensity API

Project description

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:

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

carbon_intensity_uk-0.4.0.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

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

carbon_intensity_uk-0.4.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file carbon_intensity_uk-0.4.0.tar.gz.

File metadata

  • Download URL: carbon_intensity_uk-0.4.0.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for carbon_intensity_uk-0.4.0.tar.gz
Algorithm Hash digest
SHA256 c7f325c3f390ea492b02b5386d7628e6acc51c0e896643a8bd04be8c9fa9e029
MD5 0c6b9389be543d06a69a1ebe005310bc
BLAKE2b-256 76edb7ead1251476db1caf831bc736e27275762eb8585544a465b95321f74737

See more details on using hashes here.

File details

Details for the file carbon_intensity_uk-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for carbon_intensity_uk-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8d0bd38a70279c3a759b5eaca657393616c01c4523be94d1191998cac2357c88
MD5 2c274aebf36806c21b8518d71653931f
BLAKE2b-256 2d67a69fc66974cbeccbef072fd654e182af2aefeae02ba078df82f2cd223d25

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