Skip to main content

Asynchronous Python client for getting forecast solar information

Project description

Python API fetching Solarpanels forecast information.

Project Maintenance License

GitHub Activity GitHub Last Commit Contributors

Forks Stargazers Issues

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())

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)

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! :heart_eyes:

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:

Installation

Install all packages, including all development requirements:

poetry install

Poetry creates by default an virtual environment where it installs all necessary pip packages.

Pre-commit

This repository uses the pre-commit framework, all changes are linted and tested with each commit. To setup the pre-commit check, run:

poetry run pre-commit install

And to run all checks and tests manually, use the following command:

poetry run pre-commit 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-2025 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.

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

forecast_solar-4.2.0.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

forecast_solar-4.2.0-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file forecast_solar-4.2.0.tar.gz.

File metadata

  • Download URL: forecast_solar-4.2.0.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for forecast_solar-4.2.0.tar.gz
Algorithm Hash digest
SHA256 01fd678b5213c220d23c042413deb2c992359d31a1bce319737454e38ef36211
MD5 c3a34e2cc0159aa0b47b6f6411d9952d
BLAKE2b-256 1c9b4954f45562809a44a2e2cce2e29cd905691ebf519a45b1ee06a5f74c63a2

See more details on using hashes here.

Provenance

The following attestation bundles were made for forecast_solar-4.2.0.tar.gz:

Publisher: release.yaml on home-assistant-libs/forecast_solar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file forecast_solar-4.2.0-py3-none-any.whl.

File metadata

  • Download URL: forecast_solar-4.2.0-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for forecast_solar-4.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 71f9d974d072e8812f2792c7012a40283a8aff76e618f8c727e285ebbcf872da
MD5 54616413996556cdea9ba2609e3d20b2
BLAKE2b-256 6630ca6d691d22540a438270deb06af1be3905f964caf94e93e1b3e4a49b80e2

See more details on using hashes here.

Provenance

The following attestation bundles were made for forecast_solar-4.2.0-py3-none-any.whl:

Publisher: release.yaml on home-assistant-libs/forecast_solar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page