Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump vweevers/additional-tags-action from 1.0.0 to 2.0.0 #2

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/additional-tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ jobs:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@v4.1.6
- name: 🚀 Run Release Tracker
uses: vweevers/additional-tags-action@v1.0.0
uses: vweevers/additional-tags-action@v2.0.0
73 changes: 0 additions & 73 deletions .github/workflows/tests.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ Even better: You could submit a pull request with a fix / new feature!
developers, or if you do not have permission to do that, you may request
the second reviewer to merge it for you.

[github]: https://github.com/klaasnicolaas/forecast_solar/issues
[prs]: https://github.com/klaasnicolaas/forecast_solar/pulls
[github]: https://github.com/rany2/py-solar-forecast/issues
[prs]: https://github.com/rany2/py-solar-forecast/pulls
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# MIT License

Copyright (c) 2021-2024 Klaas Schoute
Copyright (c) 2024 Rany

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
61 changes: 9 additions & 52 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,16 @@
-->

## Python API fetching Solarpanels forecast information.
<!-- PROJECT SHIELDS -->
![Project Maintenance][maintenance-shield]
[![License][license-shield]](LICENSE)

[![GitHub Activity][commits-shield]][commits]
[![GitHub Last Commit][last-commit-shield]][commits]
[![Contributors][contributors-shield]][contributors-url]

[![Forks][forks-shield]][forks-url]
[![Stargazers][stars-shield]][stars-url]
[![Issues][issues-shield]][issues-url]

## About

With this python library you can request data from [forecast.solar](https://forecast.solar) and see what your solar panels may produce in the coming days.
With this python library you can request data from [Open-Meteo](https://open-meteo.com/)
and see what your solar panels may produce in the coming days.

## Installation

```bash
pip install forecast-solar
pip install open-meteo-solar-forecast
```

## Data
Expand Down Expand Up @@ -64,22 +54,17 @@ This library returns a lot of different data, based on the API:
```python
import asyncio

from forecast_solar import ForecastSolar
from open_meteo_solar_forecast import OpenMeteoSolarForecast


async def main() -> None:
"""Show example on how to use the library."""
async with ForecastSolar(
api_key="YOUR_API_KEY",
async with OpenMeteoSolarForecast(
latitude=52.16,
longitude=4.47,
declination=20,
azimuth=10,
kwp=2.160,
damping=0,
damping_morning=0.5,
damping_evening=0.5,
horizon="0,0,0,10,10,20,20,30,30",
) as forecast:
estimate = await forecast.estimate()
print(estimate)
Expand All @@ -91,15 +76,11 @@ if __name__ == "__main__":

| Parameter | value type | Description |
| --------- | ---------- | ----------- |
| `api_key` | `str` | Your API key from [forecast.solar](https://forecast.solar) (optional) |
| `base_url` | `str` | The base URL of the API (optional) |
| `api_key` | `str` | Your API key (optional) |
| `declination` | `int` | The tilt of the solar panels (required) |
| `azimuth` | `int` | The direction the solar panels are facing (required) |
| `kwp` | `float` | The size of the solar panels in kWp (required) |
| `damping` | `float` | The damping of the solar panels, [read this][forecast-damping] for more information (optional) |
| `damping_morning` | `float` | The damping of the solar panels in the morning (optional) |
| `damping_evening` | `float` | The damping of the solar panels in the evening (optional) |
| `inverter` | `float` | The maximum power of your inverter in kilo watts (optional) |
| `horizon` | `str` | A list of **comma separated** degrees values, [read this][forecast-horizon] for more information (optional) |

## Contributing

Expand Down Expand Up @@ -131,17 +112,12 @@ poetry shell
exit
```

To run just the Python tests:

```bash
poetry run pytest
```

## License

MIT License

Copyright (c) 2021-2024 Klaas Schoute
Copyright (c) 2024 Rany

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -161,24 +137,5 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

<!-- LINKS -->
[forecast-horizon]: https://doc.forecast.solar/doku.php?id=api#horizon
[forecast-damping]: https://doc.forecast.solar/doku.php?id=damping

<!-- MARKDOWN LINKS & IMAGES -->
[maintenance-shield]: https://img.shields.io/maintenance/yes/2024.svg?style=for-the-badge
[contributors-shield]: https://img.shields.io/github/contributors/home-assistant-libs/forecast_solar.svg?style=for-the-badge
[contributors-url]: https://github.com/home-assistant-libs/forecast_solar/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/home-assistant-libs/forecast_solar.svg?style=for-the-badge
[forks-url]: https://github.com/home-assistant-libs/forecast_solar/network/members
[stars-shield]: https://img.shields.io/github/stars/home-assistant-libs/forecast_solar.svg?style=for-the-badge
[stars-url]: https://github.com/home-assistant-libs/forecast_solar/stargazers
[issues-shield]: https://img.shields.io/github/issues/home-assistant-libs/forecast_solar.svg?style=for-the-badge
[issues-url]: https://github.com/home-assistant-libs/forecast_solar/issues
[license-shield]: https://img.shields.io/github/license/home-assistant-libs/forecast_solar.svg?style=for-the-badge
[commits-shield]: https://img.shields.io/github/commit-activity/y/home-assistant-libs/forecast_solar.svg?style=for-the-badge
[commits]: https://github.com/home-assistant-libs/forecast_solar/commits/master
[last-commit-shield]: https://img.shields.io/github/last-commit/home-assistant-libs/forecast_solar.svg?style=for-the-badge

[poetry-install]: https://python-poetry.org/docs/#installation
[poetry]: https://python-poetry.org
[poetry]: https://python-poetry.org
8 changes: 0 additions & 8 deletions codecov.yml

This file was deleted.

25 changes: 7 additions & 18 deletions examples/estimate.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,24 @@
"""Example of how to get an estimate from the Forecast.Solar API."""

import asyncio
from datetime import UTC, datetime, timedelta
from pprint import pprint # noqa: F401
import dataclasses # noqa

Check failure on line 4 in examples/estimate.py

View workflow job for this annotation

GitHub Actions / Ruff

Ruff (PGH004)

examples/estimate.py:4:21: PGH004 Use specific rule codes when using `noqa`

Check failure on line 4 in examples/estimate.py

View workflow job for this annotation

GitHub Actions / Ruff

Ruff (PGH004)

examples/estimate.py:4:21: PGH004 Use specific rule codes when using `noqa`
from datetime import timedelta
from pprint import pprint # noqa

Check failure on line 6 in examples/estimate.py

View workflow job for this annotation

GitHub Actions / Ruff

Ruff (PGH004)

examples/estimate.py:6:28: PGH004 Use specific rule codes when using `noqa`

Check failure on line 6 in examples/estimate.py

View workflow job for this annotation

GitHub Actions / Ruff

Ruff (PGH004)

examples/estimate.py:6:28: PGH004 Use specific rule codes when using `noqa`

from forecast_solar import ForecastSolar, ForecastSolarRatelimitError
from open_meteo_solar_forecast import OpenMeteoSolarForecast


async def main() -> None:
"""Get an estimate from the Forecast.Solar API."""
async with ForecastSolar(
async with OpenMeteoSolarForecast(
latitude=52.16,
longitude=4.47,
declination=20,
azimuth=10,
kwp=2.160,
damping=0,
horizon="0,0,0,10,10,20,20,30,30",
efficiency_factor=0.9,
) as forecast:
try:
estimate = await forecast.estimate()
except ForecastSolarRatelimitError as err:
print("Ratelimit reached")
print(f"Rate limit resets at {err.reset_at}")
reset_period = err.reset_at - datetime.now(UTC)
# Strip microseconds as they are not informative
reset_period -= timedelta(microseconds=reset_period.microseconds)
print(f"That's in {reset_period}")
return
estimate = await forecast.estimate()

# Uncomment this if you want to see what's in the estimate arrays
# pprint(dataclasses.asdict(estimate))
Expand Down Expand Up @@ -70,8 +61,6 @@
print(f"energy_production next 12 hours: {estimate.sum_energy_production(12)}")
print(f"energy_production next 24 hours: {estimate.sum_energy_production(24)}")
print(f"timezone: {estimate.timezone}")
print(f"account_type: {estimate.account_type}")
print(forecast.ratelimit)


if __name__ == "__main__":
Expand Down
Loading
Loading