# Green Planet Energy API
[](https://badge.fury.io/py/greenplanet-energy-api)
[](https://pypi.org/project/greenplanet-energy-api/)
[](https://opensource.org/licenses/MIT)
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
```bash
pip install greenplanet-energy-api
```
## Quick Start
```python
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 tomorrow
- `async close()`: Close the HTTP session
- Context manager support for automatic cleanup
#### Response Format
The API returns a dictionary with the following keys:
- `gpe_price_00` to `gpe_price_23`: Today's hourly prices (€/kWh)
- `gpe_price_00_tomorrow` to `gpe_price_23_tomorrow`: Tomorrow's hourly prices (€/kWh)
## Error Handling
The library raises the following exceptions:
- `GreenPlanetEnergyError`: Base exception class
- `GreenPlanetEnergyConnectionError`: Network/connection issues
- `GreenPlanetEnergyAPIError`: API-specific errors
## Development
### Setup
```bash
git clone https://github.com/petschni/greenplanet-energy-api.git
cd greenplanet-energy-api
pip install -e ".[dev]"
```
### Running Tests
```bash
pytest
```
### Code Quality
```bash
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](LICENSE) file for details.
## Support
If you encounter any issues or have questions:
1. Check the [Issues](https://github.com/petschni/greenplanet-energy-api/issues) page
2. Create a new issue if needed
3. For Home Assistant related issues, please use the [Home Assistant Core Issues](https://github.com/home-assistant/core/issues) with the `green_planet_energy` label
## Disclaimer
This library is not officially associated with Green Planet Energy. It uses publicly available endpoints for retrieving pricing data.
Raw data
{
"_id": null,
"home_page": null,
"name": "greenplanet-energy-api",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": "Your Name <your.email@example.com>",
"keywords": "green planet energy, electricity prices, energy, api client, home assistant",
"author": null,
"author_email": "Your Name <your.email@example.com>",
"download_url": "https://files.pythonhosted.org/packages/7a/e3/d3b00d3252c87b85e89401286c40829e8f19951a803510ba5ada66b0e7a7/greenplanet_energy_api-0.1.2.tar.gz",
"platform": null,
"description": "# Green Planet Energy API\n\n[](https://badge.fury.io/py/greenplanet-energy-api)\n[](https://pypi.org/project/greenplanet-energy-api/)\n[](https://opensource.org/licenses/MIT)\n\nA Python API client for retrieving electricity pricing data from Green Planet Energy, a German renewable energy provider.\n\nThis 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.\n\n## Features\n\n- Async/await support\n- Fetch hourly electricity prices for today and tomorrow\n- Handles German decimal formatting \n- Comprehensive error handling\n- Type hints for better IDE support\n- Lightweight with minimal dependencies\n\n## Installation\n\n```bash\npip install greenplanet-energy-api\n```\n\n## Quick Start\n\n```python\nimport asyncio\nfrom greenplanet_energy_api import GreenPlanetEnergyAPI\n\nasync def main():\n async with GreenPlanetEnergyAPI() as api:\n # Get electricity prices for today and tomorrow\n prices = await api.get_electricity_prices()\n \n # Access today's prices\n for hour in range(24):\n price_key = f\"gpe_price_{hour:02d}\"\n if price_key in prices:\n print(f\"Hour {hour:02d}: {prices[price_key]} \u20ac/kWh\")\n \n # Access tomorrow's prices\n for hour in range(24):\n price_key = f\"gpe_price_{hour:02d}_tomorrow\"\n if price_key in prices:\n print(f\"Tomorrow Hour {hour:02d}: {prices[price_key]} \u20ac/kWh\")\n\nif __name__ == \"__main__\":\n asyncio.run(main())\n```\n\n## API Reference\n\n### GreenPlanetEnergyAPI\n\nThe main API client class.\n\n#### Methods\n\n- `async get_electricity_prices() -> dict[str, float]`: Fetch electricity prices for today and tomorrow\n- `async close()`: Close the HTTP session\n- Context manager support for automatic cleanup\n\n#### Response Format\n\nThe API returns a dictionary with the following keys:\n\n- `gpe_price_00` to `gpe_price_23`: Today's hourly prices (\u20ac/kWh)\n- `gpe_price_00_tomorrow` to `gpe_price_23_tomorrow`: Tomorrow's hourly prices (\u20ac/kWh)\n\n## Error Handling\n\nThe library raises the following exceptions:\n\n- `GreenPlanetEnergyError`: Base exception class\n- `GreenPlanetEnergyConnectionError`: Network/connection issues\n- `GreenPlanetEnergyAPIError`: API-specific errors\n\n## Development\n\n### Setup\n\n```bash\ngit clone https://github.com/petschni/greenplanet-energy-api.git\ncd greenplanet-energy-api\npip install -e \".[dev]\"\n```\n\n### Running Tests\n\n```bash\npytest\n```\n\n### Code Quality\n\n```bash\nblack src tests\nruff check src tests\nmypy src\n```\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Support\n\nIf you encounter any issues or have questions:\n\n1. Check the [Issues](https://github.com/petschni/greenplanet-energy-api/issues) page\n2. Create a new issue if needed\n3. For Home Assistant related issues, please use the [Home Assistant Core Issues](https://github.com/home-assistant/core/issues) with the `green_planet_energy` label\n\n## Disclaimer\n\nThis library is not officially associated with Green Planet Energy. It uses publicly available endpoints for retrieving pricing data.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python API client for Green Planet Energy electricity pricing data",
"version": "0.1.2",
"project_urls": {
"Changelog": "https://github.com/petschni/greenplanet-energy-api/blob/main/CHANGELOG.md",
"Homepage": "https://github.com/petschni/greenplanet-energy-api",
"Issues": "https://github.com/petschni/greenplanet-energy-api/issues",
"Repository": "https://github.com/petschni/greenplanet-energy-api"
},
"split_keywords": [
"green planet energy",
" electricity prices",
" energy",
" api client",
" home assistant"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "de60ff01f804c981b03a5391fe0536de742388bcdf62307548225cb553f4daad",
"md5": "89e271459c44c1cefa500d82e398d6d1",
"sha256": "e9f486488502fd8dbce100326fa88051bc6e8a0a583db7ef53e0b8240426060b"
},
"downloads": -1,
"filename": "greenplanet_energy_api-0.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "89e271459c44c1cefa500d82e398d6d1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 7062,
"upload_time": "2025-08-04T21:10:05",
"upload_time_iso_8601": "2025-08-04T21:10:05.340504Z",
"url": "https://files.pythonhosted.org/packages/de/60/ff01f804c981b03a5391fe0536de742388bcdf62307548225cb553f4daad/greenplanet_energy_api-0.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "7ae3d3b00d3252c87b85e89401286c40829e8f19951a803510ba5ada66b0e7a7",
"md5": "865873dd3c26ebd30422dddb7f341eef",
"sha256": "bb1882a28bbec71b53b77049296f8f567b02a8a12ae3cac25845a7761f3e8b02"
},
"downloads": -1,
"filename": "greenplanet_energy_api-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "865873dd3c26ebd30422dddb7f341eef",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 7839,
"upload_time": "2025-08-04T21:10:06",
"upload_time_iso_8601": "2025-08-04T21:10:06.717482Z",
"url": "https://files.pythonhosted.org/packages/7a/e3/d3b00d3252c87b85e89401286c40829e8f19951a803510ba5ada66b0e7a7/greenplanet_energy_api-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-04 21:10:06",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "petschni",
"github_project": "greenplanet-energy-api",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "greenplanet-energy-api"
}