Green Planet Energy API
A Python API client for retrieving electricity pricing data from Green Planet Energy, a German renewable energy provider.
This library is primarily designed for use with Home Assistant but can be used in any Python project that needs access to Green Planet Energy pricing data.
Features
- Async/await support
- Fetch hourly electricity prices for today and tomorrow
- Handles German decimal formatting
- Comprehensive error handling
- Type hints for better IDE support
- Lightweight with minimal dependencies
Installation
pip install greenplanet-energy-api
Quick Start
import asyncio
from greenplanet_energy_api import GreenPlanetEnergyAPI
async def main():
async with GreenPlanetEnergyAPI() as api:
# Get electricity prices for today and tomorrow
prices = await api.get_electricity_prices()
# Access today's prices
for hour in range(24):
price_key = f"gpe_price_{hour:02d}"
if price_key in prices:
print(f"Hour {hour:02d}: {prices[price_key]} €/kWh")
# Access tomorrow's prices
for hour in range(24):
price_key = f"gpe_price_{hour:02d}_tomorrow"
if price_key in prices:
print(f"Tomorrow Hour {hour:02d}: {prices[price_key]} €/kWh")
if __name__ == "__main__":
asyncio.run(main())
API Reference
GreenPlanetEnergyAPI
The main API client class.
Methods
async get_electricity_prices() -> dict[str, float]: Fetch electricity prices for today and tomorrowasync close(): Close the HTTP session- Context manager support for automatic cleanup
Response Format
The API returns a dictionary with the following keys:
gpe_price_00togpe_price_23: Today's hourly prices (€/kWh)gpe_price_00_tomorrowtogpe_price_23_tomorrow: Tomorrow's hourly prices (€/kWh)
Error Handling
The library raises the following exceptions:
GreenPlanetEnergyError: Base exception classGreenPlanetEnergyConnectionError: Network/connection issuesGreenPlanetEnergyAPIError: API-specific errors
Development
Setup
git clone https://github.com/petschni/greenplanet-energy-api.git
cd greenplanet-energy-api
pip install -e ".[dev]"
Running Tests
pytest
Code Quality
black src tests
ruff check src tests
mypy src
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue if needed
- For Home Assistant related issues, please use the Home Assistant Core Issues with the
green_planet_energylabel
Disclaimer
This library is not officially associated with Green Planet Energy. It uses publicly available endpoints for retrieving pricing data.
Release files for greenplanet-energy-api 0.1.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| greenplanet_energy_api-0.1.10.tar.gz | 14.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| greenplanet_energy_api-0.1.10-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.8 kB
Release files / greenplanet_energy_api-0.1.10.tar.gz
| Download URL | greenplanet_energy_api-0.1.10.tar.gz |
|---|---|
| Size | 14.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b04be163f4df17fa2583faf2fd31b37bcd0c369f8b8d77bbcbf90c083c5cea2e
|
|
BLAKE2b-256 checksum How to use checksums |
33aa57040fc9bcf02182d7396ccc80ba558b997a22eca4ffe3e084275145871a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 22, 2026.
Transparency logRelease files / greenplanet_energy_api-0.1.10-py3-none-any.whl
| Download URL | greenplanet_energy_api-0.1.10-py3-none-any.whl |
|---|---|
| Size | 9.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ee5ad3f8fe10031dbcb7e49c99b36a79bcf1fd444ebaa13194200470166fb5d0
|
|
BLAKE2b-256 checksum How to use checksums |
8e9d45967e54e540d6e652b6132068abaec35522385cada14df49584a61e9c86
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 22, 2026.
Transparency log