Cleanup: parameters: extra=forbid, optimize: battery, inverter optional (#361)

* Cleanup: parameters: extra=forbid, optimize: battery, inverter optional

 * Don't allow extra fields for parameters/REST-API (at least for now while
   changing API).
 * Allow both battery and inverter to be set optionally (atm optional
   battery not implemented, no API constraints).
 * inverter: Remove default max_power_wh
 * single_test_optimization: Add more cli-parameters

* Workflow docker-build: Don't try to authenticate for PRs

 * Secrets are not available anyway for forks.
This commit is contained in:
Dominique Lasserre
2025-01-13 21:44:17 +01:00
committed by GitHub
parent 745086c2eb
commit 9ad61f66b2
12 changed files with 119 additions and 109 deletions

View File

@@ -8,7 +8,7 @@ from typing_extensions import Self
from akkudoktoreos.core.coreabc import ConfigMixin, PredictionMixin, SingletonMixin
from akkudoktoreos.core.logging import get_logger
from akkudoktoreos.core.pydantic import PydanticBaseModel
from akkudoktoreos.core.pydantic import ParametersBaseModel, PydanticBaseModel
from akkudoktoreos.devices.battery import Battery
from akkudoktoreos.devices.generic import HomeAppliance
from akkudoktoreos.devices.inverter import Inverter
@@ -18,7 +18,7 @@ from akkudoktoreos.utils.utils import NumpyEncoder
logger = get_logger(__name__)
class EnergieManagementSystemParameters(PydanticBaseModel):
class EnergieManagementSystemParameters(ParametersBaseModel):
pv_prognose_wh: list[float] = Field(
description="An array of floats representing the forecasted photovoltaic output in watts for different time intervals."
)
@@ -50,7 +50,7 @@ class EnergieManagementSystemParameters(PydanticBaseModel):
return self
class SimulationResult(PydanticBaseModel):
class SimulationResult(ParametersBaseModel):
"""This object contains the results of the simulation and provides insights into various parameters over the entire forecast period."""
Last_Wh_pro_Stunde: list[Optional[float]] = Field(description="TBD")

View File

@@ -478,3 +478,7 @@ class PydanticDateTimeSeries(PydanticBaseModel):
dtype=str(series.dtype),
tz=tz,
)
class ParametersBaseModel(PydanticBaseModel):
model_config = ConfigDict(extra="forbid")