forecast-solar
Asynchronous Python client for getting solarpanels forecast information.
https://github.com/home-assistant-libs/forecast_solar
Category: Renewable Energy
Sub Category: Photovoltaics and Solar Energy
Keywords
api async client solarpanels
Keywords from Contributors
varta varta-storage
Last synced: about 9 hours ago
JSON representation
Repository metadata
☀️ Asynchronous Python client for getting solarpanels forecast information
- Host: GitHub
- URL: https://github.com/home-assistant-libs/forecast_solar
- Owner: home-assistant-libs
- License: mit
- Created: 2021-06-04T17:05:59.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2026-03-18T09:09:12.000Z (5 days ago)
- Last Synced: 2026-03-19T00:47:02.579Z (4 days ago)
- Topics: api, async, client, solarpanels
- Language: Python
- Homepage:
- Size: 1.12 MB
- Stars: 31
- Watchers: 8
- Forks: 13
- Open Issues: 4
- Releases: 15
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
README.md
Python API fetching Solarpanels forecast information.
About
With this python library you can request data from forecast.solar and see what your solar panels may produce in the coming days.
Installation
pip install forecast-solar
Data
This library returns a lot of different data, based on the API:
Energy
- Total Estimated Energy Production - today/tomorrow (kWh)
- Estimated Energy Production - This Hour (kWh)
- Estimated Energy Production - Next Hour (kWh)
- Estimated Energy Production - Remaining today (kWh)
Power
- Highest Power Peak Time - Today (datetime)
- Highest Power Peak Time - Tomorrow (datetime)
- Estimated Power Production - Now (W)
- Estimated Power Production - Next Hour (W)
- Estimated Power Production - In +6 Hours (W)
- Estimated Power Production - In +12 Hours (W)
- Estimated Power Production - In +24 Hours (W)
API Info
- Timezone
- Rate limit
- Account type
- Rate remaining
Validation
- API key (bool)
- Plane (bool)
Example
import asyncio
from forecast_solar import ForecastSolar
async def main() -> None:
"""Show example on how to use the library."""
async with ForecastSolar(
api_key="YOUR_API_KEY",
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(actual=2.315)
print(estimate)
if __name__ == "__main__":
asyncio.run(main())
Multiple Planes
If you have solar panels facing different directions, you can specify multiple planes.
Note: Using multiple planes requires both an API key and a Personal Plus (or higher) subscription. If no API key is provided, additional planes will be silently ignored. See the subscription plan overview for more information.
import asyncio
from forecast_solar import ForecastSolar, Plane
async def main() -> None:
"""Show example with multiple planes."""
async with ForecastSolar(
api_key="YOUR_API_KEY",
latitude=52.16,
longitude=4.47,
# First plane (primary)
declination=20,
azimuth=10,
kwp=2.160,
# Additional planes
planes=[
Plane(declination=30, azimuth=-90, kwp=1.5), # Second plane
Plane(declination=25, azimuth=90, kwp=1.0), # Third plane
],
) as forecast:
estimate = await forecast.estimate()
print(estimate)
if __name__ == "__main__":
asyncio.run(main())
ForecastSolar object
| Parameter | value type | Description |
|---|---|---|
api_key |
str |
Your API key from forecast.solar (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 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 for more information (optional) |
planes |
list[Plane] |
A list of additional Plane objects for multi-plane setups. Only used when an API key is provided (optional) |
Plane object
| Parameter | value type | Description |
|---|---|---|
declination |
float |
The tilt of the solar panels (required) |
azimuth |
float |
The direction the solar panels are facing (required) |
kwp |
float |
The size of the solar panels in kWp (required) |
estimate() method
| Parameter | value type | Description |
|---|---|---|
actual |
float |
The production in kWh for the current day so far. Only used when an API key is provided (optional) |
Contributing
Would you like to contribute to the development of this project? Then read the prepared contribution guidelines and go ahead!
Thank you for being involved! 😍
Setting up development environment
This Python project relies on Poetry as its dependency manager,
providing comprehensive management and control over project dependencies.
You need at least:
- Python 3.12+
- Poetry
Installation
Install all packages, including all development requirements:
poetry install
Poetry creates by default an virtual environment where it installs all
necessary pip packages.
Prek
This repository uses the prek framework, all changes
are linted and tested with each commit. To setup the prek check, run:
poetry run prek install
And to run all checks and tests manually, use the following command:
poetry run prek run --all-files
Testing
It uses pytest as the test framework. To run the tests:
poetry run pytest
To update the syrupy snapshot tests:
poetry run pytest --snapshot-update
License
MIT License
Copyright (c) 2021-2026 Klaas Schoute
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
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.
Owner metadata
- Name: Home Assistant Libraries
- Login: home-assistant-libs
- Email: hello@home-assistant.io
- Kind: organization
- Description: Device libraries used by Home Assistant
- Website: https://www.home-assistant.io
- Location:
- Twitter:
- Company:
- Icon url: https://avatars.githubusercontent.com/u/63743711?v=4
- Repositories: 34
- Last ynced at: 2024-03-27T12:59:17.013Z
- Profile URL: https://github.com/home-assistant-libs
GitHub Events
Total
- Release event: 4
- Delete event: 130
- Pull request event: 337
- Fork event: 2
- Issues event: 4
- Watch event: 6
- Issue comment event: 17
- Push event: 201
- Pull request review comment event: 1
- Pull request review event: 99
- Create event: 142
Last Year
- Release event: 3
- Delete event: 72
- Pull request event: 214
- Fork event: 2
- Issues event: 3
- Watch event: 5
- Issue comment event: 12
- Push event: 123
- Pull request review comment event: 1
- Pull request review event: 47
- Create event: 78
Committers metadata
Last synced: 6 months ago
Total Commits: 229
Total Committers: 13
Avg Commits per committer: 17.615
Development Distribution Score (DDS): 0.271
Commits in past year: 149
Committers in past year: 4
Avg Commits per committer in past year: 37.25
Development Distribution Score (DDS) in past year: 0.074
| Name | Commits | |
|---|---|---|
| dependabot[bot] | 4****]@u****m | 167 |
| Klaas Schoute | k****e@h****m | 44 |
| Paulus Schoutsen | p****s@p****l | 4 |
| Björn Dalfors | b****n@u****m | 3 |
| Franck Nijhof | g****t@f****v | 2 |
| Martin Hjelmare | m****2@g****m | 2 |
| Franck Nijhof | f****k@f****l | 1 |
| GreenOpposite | h****d@g****m | 1 |
| J. Nick Koston | n****b@k****g | 1 |
| Jesse Hills | 3****z@u****m | 1 |
| Knut Kohl | g****b@k****e | 1 |
| Ondřej Kolenatý | o****y@i****z | 1 |
| Ondřej Kolenatý | o****j@k****z | 1 |
Committer domains:
- kolenaty.cz: 1
- intax.cz: 1
- knutkohl.de: 1
- koston.org: 1
- frenck.nl: 1
- frenck.dev: 1
- paulusschoutsen.nl: 1
Issue and Pull Request metadata
Last synced: 5 days ago
Total issues: 13
Total pull requests: 381
Average time to close issues: 29 days
Average time to close pull requests: 10 days
Total issue authors: 12
Total pull request authors: 13
Average comments per issue: 1.15
Average comments per pull request: 0.35
Merged pull request: 342
Bot issues: 1
Bot pull requests: 295
Past year issues: 3
Past year pull requests: 106
Past year average time to close issues: about 5 hours
Past year average time to close pull requests: 1 day
Past year issue authors: 3
Past year pull request authors: 4
Past year average comments per issue: 0.33
Past year average comments per pull request: 0.15
Past year merged pull request: 83
Past year bot issues: 0
Past year bot pull requests: 99
Top Issue Authors
- K-Ko (2)
- henfri (1)
- bmwmotor (1)
- wawyed (1)
- RikiSot (1)
- Taffmailer (1)
- ianmcorvidae (1)
- dependabot[bot] (1)
- mauromanfrin (1)
- LasseHedeby (1)
- binsentsu (1)
- incaseoftrouble (1)
Top Pull Request Authors
- dependabot[bot] (295)
- klaasnicolaas (61)
- bj00rn (6)
- frenck (3)
- balloob (3)
- anikrooz (2)
- bdraco (2)
- GreenOpposite (2)
- koleo9am (2)
- MartinHjelmare (2)
- jesserockz (1)
- artspb (1)
- K-Ko (1)
Top Issue Labels
- bugfix (1)
- dependencies (1)
- github_actions (1)
Top Pull Request Labels
- dependencies (295)
- python (188)
- github_actions (73)
- minor (42)
- maintenance (21)
- ci (18)
- new-feature (16)
- bugfix (12)
- enhancement (8)
- refactor (8)
- breaking-change (7)
- major (7)
- documentation (4)
Package metadata
- Total packages: 11
-
Total downloads:
- pypi: 12,811 last-month
- Total docker downloads: 757,191,493
- Total dependent packages: 0 (may contain duplicates)
- Total dependent repositories: 16 (may contain duplicates)
- Total versions: 27
- Total maintainers: 2
pypi.org: forecast-solar
Asynchronous Python client for getting forecast solar information
- Homepage: https://github.com/home-assistant-libs/forecast_solar
- Documentation: https://github.com/home-assistant-libs/forecast_solar
- Licenses: MIT
- Latest release: 5.0.0 (published 30 days ago)
- Last Synced: 2026-02-21T23:26:49.137Z (29 days ago)
- Versions: 15
- Dependent Packages: 0
- Dependent Repositories: 16
- Downloads: 12,811 Last month
- Docker Downloads: 757,191,493
-
Rankings:
- Docker downloads count: 0.191%
- Dependent repos count: 3.618%
- Downloads: 4.203%
- Average: 7.53%
- Dependent packages count: 10.052%
- Forks count: 11.93%
- Stargazers count: 15.188%
- Maintainers (1)
nixpkgs-24.05: python311Packages.forecast-solar
Asynchronous Python client for getting forecast solar information
- Homepage: https://github.com/home-assistant-libs/forecast_solar
- Documentation: https://github.com/NixOS/nixpkgs/blob/nixos-24.05/pkgs/development/python-modules/forecast-solar/default.nix#L40
- Licenses: MIT
- Latest release: 3.1.0 (published about 2 months ago)
- Last Synced: 2026-03-07T05:09:34.243Z (16 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Maintainers (1)
nixpkgs-23.11: python311Packages.forecast-solar
Asynchronous Python client for getting forecast solar information
- Homepage: https://github.com/home-assistant-libs/forecast_solar
- Documentation: https://github.com/NixOS/nixpkgs/blob/nixos-23.11/pkgs/development/python-modules/forecast-solar/default.nix#L40
- Licenses: MIT
- Latest release: 3.0.0 (published about 2 months ago)
- Last Synced: 2026-03-04T04:51:12.036Z (19 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
- Maintainers (1)
nixpkgs-24.05: python312Packages.forecast-solar
Asynchronous Python client for getting forecast solar information
- Homepage: https://github.com/home-assistant-libs/forecast_solar
- Documentation: https://github.com/NixOS/nixpkgs/blob/nixos-24.05/pkgs/development/python-modules/forecast-solar/default.nix#L40
- Licenses: MIT
- Latest release: 3.1.0 (published about 2 months ago)
- Last Synced: 2026-03-07T11:10:33.781Z (16 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Maintainers (1)
nixpkgs-24.11: python311Packages.forecast-solar
Asynchronous Python client for getting forecast solar information
- Homepage: https://github.com/home-assistant-libs/forecast_solar
- Documentation: https://github.com/NixOS/nixpkgs/blob/nixos-24.11/pkgs/development/python-modules/forecast-solar/default.nix#L41
- Licenses: MIT
- Latest release: 3.1.0 (published about 2 months ago)
- Last Synced: 2026-03-05T02:19:05.112Z (18 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Maintainers (1)
nixpkgs-unstable: python314Packages.forecast-solar
Asynchronous Python client for getting forecast solar information
- Homepage: https://github.com/home-assistant-libs/forecast_solar
- Documentation: https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/development/python-modules/forecast-solar/default.nix#L65
- Licenses: MIT
- Latest release: 5.0.0 (published 18 days ago)
- Last Synced: 2026-03-05T10:13:25.288Z (18 days ago)
- Versions: 2
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Maintainers (1)
nixpkgs-23.05: python311Packages.forecast-solar
Asynchronous Python client for getting forecast solar information
- Homepage: https://github.com/home-assistant-libs/forecast_solar
- Documentation: https://github.com/NixOS/nixpkgs/blob/nixos-23.05/pkgs/development/python-modules/forecast-solar/default.nix#L40
- Licenses: MIT
- Latest release: 3.0.0 (published about 2 months ago)
- Last Synced: 2026-03-03T07:34:32.300Z (20 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
- Maintainers (1)
nixpkgs-24.11: python312Packages.forecast-solar
Asynchronous Python client for getting forecast solar information
- Homepage: https://github.com/home-assistant-libs/forecast_solar
- Documentation: https://github.com/NixOS/nixpkgs/blob/nixos-24.11/pkgs/development/python-modules/forecast-solar/default.nix#L41
- Licenses: MIT
- Latest release: 3.1.0 (published about 2 months ago)
- Last Synced: 2026-03-03T18:24:23.190Z (20 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
- Maintainers (1)
nixpkgs-23.05: python310Packages.forecast-solar
Asynchronous Python client for getting forecast solar information
- Homepage: https://github.com/home-assistant-libs/forecast_solar
- Documentation: https://github.com/NixOS/nixpkgs/blob/nixos-23.05/pkgs/development/python-modules/forecast-solar/default.nix#L40
- Licenses: MIT
- Latest release: 3.0.0 (published about 2 months ago)
- Last Synced: 2026-03-03T18:28:44.231Z (20 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
- Maintainers (1)
nixpkgs-23.11: python310Packages.forecast-solar
Asynchronous Python client for getting forecast solar information
- Homepage: https://github.com/home-assistant-libs/forecast_solar
- Documentation: https://github.com/NixOS/nixpkgs/blob/nixos-23.11/pkgs/development/python-modules/forecast-solar/default.nix#L40
- Licenses: MIT
- Latest release: 3.0.0 (published about 2 months ago)
- Last Synced: 2026-03-08T20:30:50.821Z (15 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
- Maintainers (1)
nixpkgs-unstable: python313Packages.forecast-solar
Asynchronous Python client for getting forecast solar information
- Homepage: https://github.com/home-assistant-libs/forecast_solar
- Documentation: https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/development/python-modules/forecast-solar/default.nix#L65
- Licenses: MIT
- Latest release: 5.0.0 (published 17 days ago)
- Last Synced: 2026-03-06T13:41:17.083Z (17 days ago)
- Versions: 2
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Maintainers (1)
Dependencies
- actions/checkout v3.0.2 composite
- vweevers/additional-tags-action v1.0.0 composite
- actions/checkout v3.0.2 composite
- micnncim/action-label-syncer v1.3.0 composite
- actions/checkout v3.0.2 composite
- actions/setup-python v4.2.0 composite
- jesusvasquez333/verify-pr-label-action v1.4.0 composite
- release-drafter/release-drafter v6.0.0 composite
- aiodns 3.2.0
- aiohttp 3.9.5
- aiosignal 1.3.1
- attrs 23.2.0
- black 24.4.2
- cffi 1.16.0
- click 8.1.7
- colorama 0.4.6
- covdefaults 2.3.0
- coverage 7.5.0
- flake8 7.0.0
- frozenlist 1.4.1
- idna 3.7
- iniconfig 2.0.0
- mccabe 0.7.0
- multidict 6.0.5
- mypy-extensions 1.0.0
- packaging 24.0
- pathspec 0.12.1
- platformdirs 4.2.1
- pluggy 1.5.0
- pycares 4.4.0
- pycodestyle 2.11.1
- pycparser 2.22
- pyflakes 3.2.0
- pytest 8.1.1
- pytest-asyncio 0.23.6
- pytest-cov 5.0.0
- yarl 1.9.4
- black 24.4.2 develop
- covdefaults 2.3.0 develop
- coverage 7.5.0 develop
- flake8 7.0.0 develop
- pytest 8.1.1 develop
- pytest-asyncio 0.23.6 develop
- pytest-cov 5.0.0 develop
- aiodns >=3.0.0
- aiohttp >=3.0.0
- python ^3.11
- yarl >=1.6.0
- actions/checkout v4.1.4 composite
- actions/setup-python v5.1.0 composite
- actions/checkout v4.1.4 composite
- actions/download-artifact v4.1.7 composite
- actions/setup-python v5.1.0 composite
- actions/upload-artifact v4.3.3 composite
- codecov/codecov-action v4.3.0 composite
Score: 26.565441172778876