fix: provider settings in top level field of configuration (#1161)

Configuration for some providers was given in the sub-field `provider_settings`
combining the settings of several providers. Pydantic does not understand
this very well and the configuration became cumbersome, especially in EOSdash.

All provider settings from the `provider-settings` sub-field are now lifted
to the top level field of the configuration.

The changes are automatically migrated in the configuration.

Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
This commit is contained in:
Bobby Noelte
2026-07-20 14:37:03 +02:00
committed by GitHub
parent 845191c0d0
commit 3bb0e02aed
44 changed files with 798 additions and 1061 deletions
+6 -6
View File
@@ -26,14 +26,14 @@ class VrmForecastResponse(PydanticBaseModel):
class LoadVrmCommonSettings(SettingsBaseModel):
"""Common settings for load forecast VRM API."""
load_vrm_token: str = Field(
token: str = Field(
default="your-token",
json_schema_extra={
"description": "Token for Connecting VRM API",
"description": "Access token for connecting to the Victron Remote Management (VRM) API",
"examples": ["your-token"],
},
)
load_vrm_idsite: int = Field(
site_id: int = Field(
default=12345, json_schema_extra={"description": "VRM-Installation-ID", "examples": [12345]}
)
@@ -62,9 +62,9 @@ class LoadVrm(LoadProvider):
def _request_forecast(self, start_ts: int, end_ts: int) -> VrmForecastResponse:
"""Fetch forecast data from Victron VRM API."""
base_url = "https://vrmapi.victronenergy.com/v2/installations"
vrm_settings = self.config.load.loadvrm
installation_id = vrm_settings.load_vrm_idsite
api_token = vrm_settings.load_vrm_token
vrm_settings = self.config.load.vrm
installation_id = vrm_settings.site_id
api_token = vrm_settings.token
url = f"{base_url}/{installation_id}/stats?type=forecast&start={start_ts}&end={end_ts}&interval=hours"
headers = {"X-Authorization": f"Token {api_token}", "Content-Type": "application/json"}