feat: rename remaining German API fields and deprecate legacy endpoints (#1164)
Bump Version / Bump Version Workflow (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
docker-build / platform-excludes (push) Has been cancelled
pre-commit / pre-commit (push) Has been cancelled
Run Pytest on Pull Request / test (push) Has been cancelled
docker-build / build (push) Has been cancelled
docker-build / merge (push) Has been cancelled
Close stale pull requests/issues / Find Stale issues and PRs (push) Has been cancelled

Complete the English API translation started in #675:

- rename input fields pv_akku to pv_battery and eauto to ev, and the
  solution fields eautocharge_hours_float to ev_charge_hours_float and
  eauto_obj to ev_obj; the German names are still accepted on input
  via validation aliases and re-emitted in responses as deprecated
  computed fields, same pattern as #675
- mark the legacy endpoints /strompreis, /gesamtlast and
  /gesamtlast_simple as deprecated in the OpenAPI schema
- use amount instead of a euro reference in the battery LCOS log
  message

Co-authored-by: Tobias Welz <tobias.wizneteu@gmail.com>
This commit is contained in:
7tobias
2026-07-21 10:22:50 +02:00
committed by GitHub
co-authored by Tobias Welz
parent 641873d867
commit 8d72177671
10 changed files with 215 additions and 101 deletions
@@ -137,10 +137,18 @@ class GeneticOptimizationParameters(
optimization process, such as forecasts, pricing, battery and appliance models.
"""
model_config = ConfigDict(populate_by_name=True, extra="ignore")
ems: GeneticEnergyManagementParameters
pv_akku: Optional[SolarPanelBatteryParameters]
pv_battery: Optional[SolarPanelBatteryParameters] = Field(
validation_alias=AliasChoices("pv_battery", "pv_akku"),
json_schema_extra={"description": "PV battery parameters."},
)
inverter: Optional[InverterParameters]
eauto: Optional[ElectricVehicleParameters]
ev: Optional[ElectricVehicleParameters] = Field(
validation_alias=AliasChoices("ev", "eauto"),
json_schema_extra={"description": "Electric vehicle parameters."},
)
dishwasher: Optional[HomeApplianceParameters] = None
temperature_forecast: Optional[list[Optional[float]]] = Field(
default=None,
@@ -155,6 +163,17 @@ class GeneticOptimizationParameters(
},
)
# Computed fields for backward compatibility (deprecated German names)
@computed_field(json_schema_extra={"deprecated": True})
def pv_akku(self) -> Optional[SolarPanelBatteryParameters]:
"""Deprecated: Use pv_battery instead."""
return self.pv_battery
@computed_field(json_schema_extra={"deprecated": True})
def eauto(self) -> Optional[ElectricVehicleParameters]:
"""Deprecated: Use ev instead."""
return self.ev
@model_validator(mode="after")
def validate_list_length(self) -> Self:
"""Ensure that temperature forecast list matches the PV forecast length.
@@ -457,7 +476,7 @@ class GeneticOptimizationParameters(
# Levelized cost of ownership
if battery_config.levelized_cost_of_storage_kwh is None:
logger.info(
"No battery device LCOS data available - defaulting to 0 €/kWh. Parameter preparation attempt {}.",
"No battery device LCOS data available - defaulting to 0 [amount/kWh]. Parameter preparation attempt {}.",
attempt,
)
battery_config.levelized_cost_of_storage_kwh = 0
@@ -669,8 +688,8 @@ class GeneticOptimizationParameters(
price_per_wh_battery=battery_lcos_kwh / 1000,
),
temperature_forecast=weather_temp_air,
pv_akku=battery_params,
eauto=electric_vehicle_params,
pv_battery=battery_params,
ev=electric_vehicle_params,
inverter=inverter_params,
dishwasher=home_appliance_params,
start_solution=start_solution,