Skip to main content

alt Banner of the Solcast package

GitHub Release Python Versions Project Stage Project Maintenance License

GitHub Activity PyPi Downloads GitHub Last Commit Open in Dev Containers

Build Status Typing Status Code Coverage OpenSSF Scorecard

Asynchronous Python client for Solcast.

About

Solcast provides solar radiation and solar power forecasts, estimated and historical data. This package allows you to get the data from the API and use it in your own application.

Rooftop forecasts are supported for Solcast hobbyist accounts.

Installation

pip install solcast-pv

Datasets

  • List of all your created rooftop sites linked to your account.
  • Get rate limits for your account.
  • Fetch rooftop forecasts, including central, lower and upper power estimates.
CLICK HERE! to see all datasets

Rooftop Site

Note: requesting the list of all your created rooftop sites linked to your account, will not affect your daily rate limit.

Name Type Description
name str The name of the rooftop site.
resource_id str The unique identifier of the rooftop site.
install_date datetime The installation date of your solar panels.
capacity float The capacity of the solar panels.
capacity_dc float The capacity of the solar panels in DC.
azimuth int The azimuth of the solar panels.
tilt int The tilt of the solar panels.
loss_factor float The loss factor of the solar panels.

Rate Limits

Note: requesting the rate limits for your account will not affect your daily rate limit.

Name Type Description
daily_limit int The daily limit of API calls.
remaining_daily int The remaining daily limit of API calls.
consumed_daily int How many API calls you have consumed today.

Example

import asyncio

from solcast_pv import Solcast, RooftopSite


async def main() -> None:
    """Show example on using this package."""
    async with Solcast(token="API_KEY") as client:
        rooftops: list[RooftopSite] = await client.get_rooftop_sites()
        print(rooftops)


if __name__ == "__main__":
    asyncio.run(main())

Rooftop forecast

async with Solcast(token="API_KEY", timezone="Europe/Amsterdam") as client:
    forecast = await client.get_rooftop_forecast("ROOFTOP_RESOURCE_ID", hours=48)
    print(forecast.total_energy_forecast_today)  # kWh, local calendar day
    print(forecast.power_forecast_now)  # W
    print(forecast.energy_forecast_current_hour)  # kWh, next elapsed hour

Forecast dictionaries contain average power in kW, keyed by interval end in UTC. Energy calculations use each interval's duration and include partial intervals. Calendar-day calculations use the selected timezone, including 23- and 25-hour days. Peak-time methods return the end of the peak interval in that timezone and raise RuntimeError when no interval is available.

Each forecast call makes one API request. The client does not poll or retry requests automatically. Hobbyist accounts currently allow up to 10 requests per UTC day; schedule and cache requests in your application, accounting for all rooftop sites. HTTP 429 raises SolcastRateLimitError (a subclass of SolcastConnectionError). Malformed forecast data raises SolcastResultsError. See the official hobbyist API documentation.

Site listing and usage-allowance methods remain available for compatible accounts; their availability can differ from the documented forecast endpoint.

More examples can be found in the examples folder.

Contributing

This is an active open-source project. We are always open to people who want to use the code or contribute to it.

We've set up a separate document for our contribution guidelines.

Thank you for being involved! :heart_eyes:

Setting up development environment

The simplest way to begin is by utilizing the Dev Container feature of Visual Studio Code or by opening a CodeSpace directly on GitHub. By clicking the button below you immediately start a Dev Container in Visual Studio Code.

Open in Dev Containers

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.

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) 2024-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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

solcast_pv-1.0.0.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

solcast_pv-1.0.0-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file solcast_pv-1.0.0.tar.gz.

File metadata

  • Download URL: solcast_pv-1.0.0.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for solcast_pv-1.0.0.tar.gz
Algorithm Hash digest
SHA256 3ac1aa775fe980af07e162df720a9f3831b85211e565ba026226018d180e614f
MD5 c4d0775f370062597a86cfd31757971d
BLAKE2b-256 d879ea945d28fe138c4829a47dad7a4f2fc0c164ed31ba944236d2313b6889d0

See more details on using hashes here.

Provenance

The following attestation bundles were made for solcast_pv-1.0.0.tar.gz:

Publisher: release.yaml on klaasnicolaas/python-solcast-pv

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

File details

Details for the file solcast_pv-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: solcast_pv-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for solcast_pv-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6fca9489b975dd9ffbce6819491639f7d96fe47f9f2bff0f62c01264b3d9507d
MD5 b845899c5d43ddcd2f1e47a9986eec2b
BLAKE2b-256 8194ed5d4d7f4cba6ba4f3f70c3a954cebf8cff128c7b40e49b1928fdb3f108a

See more details on using hashes here.

Provenance

The following attestation bundles were made for solcast_pv-1.0.0-py3-none-any.whl:

Publisher: release.yaml on klaasnicolaas/python-solcast-pv

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

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page