From 43ebbc2e55871dff322808d17823893479fa3703 Mon Sep 17 00:00:00 2001 From: Bobby Noelte Date: Tue, 21 Jan 2025 16:56:42 +0100 Subject: [PATCH] Fix gesamtlast_simple (#399) Legacy endpoint gesamtlast_simple expected yearly energy consumption to be given in Wh SI units. Signed-off-by: Bobby Noelte --- docs/_generated/openapi.md | 3 +++ openapi.json | 2 +- src/akkudoktoreos/server/eos.py | 5 ++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/_generated/openapi.md b/docs/_generated/openapi.md index 9e4d859..4c1c74f 100644 --- a/docs/_generated/openapi.md +++ b/docs/_generated/openapi.md @@ -59,6 +59,9 @@ Total load prediction starts at 00.00.00 today and is provided for 48 hours. If no prediction values are available the missing ones at the start of the series are filled with the first available prediction value. +Args: + year_energy (float): Yearly energy consumption in Wh. + Note: Set LoadAkkudoktor as load_provider, then update data with '/v1/prediction/update' diff --git a/openapi.json b/openapi.json index 87a7e75..41b22a8 100644 --- a/openapi.json +++ b/openapi.json @@ -3806,7 +3806,7 @@ "/gesamtlast_simple": { "get": { "summary": "Fastapi Gesamtlast Simple", - "description": "Deprecated: Total Load Prediction.\n\nEndpoint to handle total load prediction.\n\nTotal load prediction starts at 00.00.00 today and is provided for 48 hours.\nIf no prediction values are available the missing ones at the start of the series are\nfilled with the first available prediction value.\n\nNote:\n Set LoadAkkudoktor as load_provider, then update data with\n '/v1/prediction/update'\n and then request data with\n '/v1/prediction/list?key=load_mean' instead.", + "description": "Deprecated: Total Load Prediction.\n\nEndpoint to handle total load prediction.\n\nTotal load prediction starts at 00.00.00 today and is provided for 48 hours.\nIf no prediction values are available the missing ones at the start of the series are\nfilled with the first available prediction value.\n\nArgs:\n year_energy (float): Yearly energy consumption in Wh.\n\nNote:\n Set LoadAkkudoktor as load_provider, then update data with\n '/v1/prediction/update'\n and then request data with\n '/v1/prediction/list?key=load_mean' instead.", "operationId": "fastapi_gesamtlast_simple_gesamtlast_simple_get", "parameters": [ { diff --git a/src/akkudoktoreos/server/eos.py b/src/akkudoktoreos/server/eos.py index 4fd8aa2..72194f5 100755 --- a/src/akkudoktoreos/server/eos.py +++ b/src/akkudoktoreos/server/eos.py @@ -661,6 +661,9 @@ def fastapi_gesamtlast_simple(year_energy: float) -> list[float]: If no prediction values are available the missing ones at the start of the series are filled with the first available prediction value. + Args: + year_energy (float): Yearly energy consumption in Wh. + Note: Set LoadAkkudoktor as load_provider, then update data with '/v1/prediction/update' @@ -669,7 +672,7 @@ def fastapi_gesamtlast_simple(year_energy: float) -> list[float]: """ settings = SettingsEOS( load_provider="LoadAkkudoktor", - loadakkudoktor_year_energy=year_energy, + loadakkudoktor_year_energy=year_energy / 1000, # Convert to kWh ) config_eos.merge_settings(settings=settings) ems_eos.set_start_datetime() # Set energy management start datetime to current hour.