mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2025-10-31 23:06:20 +00:00
fix: generate config markdown
Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
This commit is contained in:
11
openapi.json
11
openapi.json
@@ -5803,9 +5803,13 @@
|
||||
"title": "Total Costs Amt",
|
||||
"description": "The total costs [money amount]."
|
||||
},
|
||||
"data": {
|
||||
"prediction": {
|
||||
"$ref": "#/components/schemas/PydanticDateTimeDataFrame",
|
||||
"description": "Datetime data frame with time series optimization data per optimization interval:- load_energy_wh: Load of all energy consumers in wh- grid_energy_wh: Grid energy feed in (negative) or consumption (positive) in wh- pv_prediction_energy_wh: PV energy prediction (positive) in wh- elec_price_prediction_amt_kwh: Electricity price prediction in money per kwh- costs_amt: Costs in money amount- revenue_amt: Revenue in money amount- losses_energy_wh: Energy losses in wh- <device-id>_operation_mode_id: Operation mode id of the device.- <device-id>_operation_mode_factor: Operation mode factor of the device.- <device-id>_soc_factor: State of charge of a battery/ electric vehicle device as factor of total capacity.- <device-id>_energy_wh: Energy consumption (positive) of a device in wh."
|
||||
"description": "Datetime data frame with time series prediction data per optimization interval:- pv_energy_wh: PV energy prediction (positive) in wh- elec_price_amt_kwh: Electricity price prediction in money per kwh- feed_in_tariff_amt_kwh: Feed in tariff prediction in money per kwh- weather_temp_air_celcius: Temperature in \u00b0C- load_mean_energy_wh: Load mean energy prediction in wh- load_std_energy_wh: Load energy standard deviation prediction in wh- load_mean_adjusted_energy_w: Adjusted load mean energy prediction in wh"
|
||||
},
|
||||
"solution": {
|
||||
"$ref": "#/components/schemas/PydanticDateTimeDataFrame",
|
||||
"description": "Datetime data frame with time series solution data per optimization interval:- load_energy_wh: Load of all energy consumers in wh- grid_energy_wh: Grid energy feed in (negative) or consumption (positive) in wh- costs_amt: Costs in money amount- revenue_amt: Revenue in money amount- losses_energy_wh: Energy losses in wh- <device-id>_operation_mode_id: Operation mode id of the device.- <device-id>_operation_mode_factor: Operation mode factor of the device.- <device-id>_soc_factor: State of charge of a battery/ electric vehicle device as factor of total capacity.- <device-id>_energy_wh: Energy consumption (positive) of a device in wh."
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
@@ -5815,7 +5819,8 @@
|
||||
"total_losses_energy_wh",
|
||||
"total_revenues_amt",
|
||||
"total_costs_amt",
|
||||
"data"
|
||||
"prediction",
|
||||
"solution"
|
||||
],
|
||||
"title": "OptimizationSolution",
|
||||
"description": "General Optimization Solution."
|
||||
|
||||
@@ -8,7 +8,7 @@ import re
|
||||
import sys
|
||||
import textwrap
|
||||
from pathlib import Path
|
||||
from typing import Any, Union
|
||||
from typing import Any, Type, Union
|
||||
|
||||
from loguru import logger
|
||||
from pydantic.fields import ComputedFieldInfo, FieldInfo
|
||||
@@ -199,7 +199,8 @@ def generate_config_table_md(
|
||||
description = deprecated
|
||||
table += f"| {field_name} {env_entry}| `{type_name}` | `{read_only}` | `{default_value}` | {description} |\n"
|
||||
|
||||
inner_types: dict[PydanticBaseModel, tuple[str, list[str]]] = dict()
|
||||
# inner_types: dict[type[PydanticBaseModel], tuple[str, list[str]]] = dict()
|
||||
inner_types: dict[Any, tuple[str, list[str]]] = dict()
|
||||
|
||||
def extract_nested_models(subtype: Any, subprefix: str, parent_types: list[str]):
|
||||
"""Extract nested models."""
|
||||
@@ -207,7 +208,9 @@ def generate_config_table_md(
|
||||
return
|
||||
nested_types = resolve_nested_types(subtype, [])
|
||||
for nested_type, nested_parent_types in nested_types:
|
||||
if issubclass(nested_type, PydanticBaseModel):
|
||||
# Nested type may be of type class, enum, typing.Any
|
||||
if isinstance(nested_type, type) and issubclass(nested_type, PydanticBaseModel):
|
||||
# Nested type is a subclass of PydanticBaseModel
|
||||
new_parent_types = parent_types + nested_parent_types
|
||||
if "list" in parent_types:
|
||||
new_prefix = ""
|
||||
|
||||
Reference in New Issue
Block a user