mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2025-10-12 04:16:16 +00:00
Nested config, devices registry
* All config now nested. - Use default config from model field default values. If providers should be enabled by default, non-empty default config file could be provided again. - Environment variable support with EOS_ prefix and __ between levels, e.g. EOS_SERVER__EOS_SERVER_PORT=8503 where all values are case insensitive. For more information see: https://docs.pydantic.dev/latest/concepts/pydantic_settings/#parsing-environment-variable-values - Use devices as registry for configured devices. DeviceBase as base class with for now just initializion support (in the future expand to operations during optimization). - Strip down ConfigEOS to the only configuration instance. Reload from file or reset to defaults is possible. * Fix multi-initialization of derived SingletonMixin classes.
This commit is contained in:
@@ -6,6 +6,7 @@ from pydantic import Field, computed_field
|
||||
|
||||
from akkudoktoreos.config.configabc import SettingsBaseModel
|
||||
from akkudoktoreos.core.logging import get_logger
|
||||
from akkudoktoreos.prediction.pvforecastimport import PVForecastImportCommonSettings
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
@@ -260,7 +261,7 @@ class PVForecastCommonSettings(SettingsBaseModel):
|
||||
default=None, description="Nominal power of PV system in kW."
|
||||
)
|
||||
pvforecast4_pvtechchoice: Optional[str] = Field(
|
||||
"crystSi", description="PV technology. One of 'crystSi', 'CIS', 'CdTe', 'Unknown'."
|
||||
default="crystSi", description="PV technology. One of 'crystSi', 'CIS', 'CdTe', 'Unknown'."
|
||||
)
|
||||
pvforecast4_mountingplace: Optional[str] = Field(
|
||||
default="free",
|
||||
@@ -316,7 +317,7 @@ class PVForecastCommonSettings(SettingsBaseModel):
|
||||
default=None, description="Nominal power of PV system in kW."
|
||||
)
|
||||
pvforecast5_pvtechchoice: Optional[str] = Field(
|
||||
"crystSi", description="PV technology. One of 'crystSi', 'CIS', 'CdTe', 'Unknown'."
|
||||
default="crystSi", description="PV technology. One of 'crystSi', 'CIS', 'CdTe', 'Unknown'."
|
||||
)
|
||||
pvforecast5_mountingplace: Optional[str] = Field(
|
||||
default="free",
|
||||
@@ -359,6 +360,8 @@ class PVForecastCommonSettings(SettingsBaseModel):
|
||||
|
||||
pvforecast_max_planes: ClassVar[int] = 6 # Maximum number of planes that can be set
|
||||
|
||||
provider_settings: Optional[PVForecastImportCommonSettings] = None
|
||||
|
||||
# Computed fields
|
||||
@computed_field # type: ignore[prop-decorator]
|
||||
@property
|
||||
|
Reference in New Issue
Block a user