mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2026-07-12 21:08:13 +00:00
feat(prediction): add Forecast.Solar PV forecast provider
Add PVForecastForecastSolar, a PV forecast provider for the free Forecast.Solar API (https://forecast.solar), giving operators a no-account forecast source in addition to Akkudoktor, VRM, Import and pvnode. An optional API key raises the rate limit. result.watts is the instantaneous AC power per timestamp, fed directly as pvforecast_ac_power. Plants with several roof planes issue one request per plane (Forecast.Solar is single-plane) and the powers are summed per timestamp. Forecast.Solar azimuth (-180=N..0=S..90=W) is converted from EOS surface_azimuth (north=0..south=180); local wall-clock timestamps are resolved via the response timezone before resampling. Registered in pvforecast.py and prediction.py. Adds tests for timezone resolution, azimuth conversion, multi-plane summation and HTTP-error handling.
This commit is contained in:
@@ -7,6 +7,9 @@ from pydantic import Field, computed_field, field_validator, model_validator
|
||||
from akkudoktoreos.config.configabc import SettingsBaseModel
|
||||
from akkudoktoreos.core.coreabc import get_prediction
|
||||
from akkudoktoreos.prediction.pvforecastabc import PVForecastProvider
|
||||
from akkudoktoreos.prediction.pvforecastforecastsolar import (
|
||||
PVForecastForecastSolarCommonSettings,
|
||||
)
|
||||
from akkudoktoreos.prediction.pvforecastimport import PVForecastImportCommonSettings
|
||||
from akkudoktoreos.prediction.pvforecastpvnode import PVForecastPVNodeCommonSettings
|
||||
from akkudoktoreos.prediction.pvforecastvrm import PVForecastVrmCommonSettings
|
||||
@@ -19,7 +22,13 @@ def pvforecast_provider_ids() -> list[str]:
|
||||
except:
|
||||
# Prediction may not be initialized
|
||||
# Return at least provider used in example
|
||||
return ["PVForecastAkkudoktor", "PVForecastImport", "PVForecastVrm", "PVForecastPVNode"]
|
||||
return [
|
||||
"PVForecastAkkudoktor",
|
||||
"PVForecastImport",
|
||||
"PVForecastVrm",
|
||||
"PVForecastPVNode",
|
||||
"PVForecastForecastSolar",
|
||||
]
|
||||
|
||||
return [
|
||||
provider.provider_id()
|
||||
@@ -184,6 +193,10 @@ class PVForecastCommonProviderSettings(SettingsBaseModel):
|
||||
default=None,
|
||||
json_schema_extra={"description": "PVForecastPVNode settings", "examples": [None]},
|
||||
)
|
||||
PVForecastForecastSolar: Optional[PVForecastForecastSolarCommonSettings] = Field(
|
||||
default=None,
|
||||
json_schema_extra={"description": "PVForecastForecastSolar settings", "examples": [None]},
|
||||
)
|
||||
|
||||
|
||||
class PVForecastCommonSettings(SettingsBaseModel):
|
||||
|
||||
Reference in New Issue
Block a user