fix: server crash on prediction update failure (#1222)

Catch exceptions from prediction update and log as error message. Keep
executing the energy management run.

Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
This commit is contained in:
Bobby Noelte
2026-08-08 11:37:50 +02:00
committed by GitHub
parent 74d31e2fac
commit 269d2162a9
5 changed files with 14 additions and 5 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ DOCKER_COMPOSE_DATA_DIR=${HOME}/.local/share/net.akkudoktor.eos
# -----------------------------------------------------------------------------
# Image / build
# -----------------------------------------------------------------------------
VERSION=0.3.0.dev2608010961051894
VERSION=0.3.0.dev2608080910933529
PYTHON_VERSION=3.13.9
# -----------------------------------------------------------------------------
+1 -1
View File
@@ -6,7 +6,7 @@
# the root directory (no add-on folder as usual).
name: "Akkudoktor-EOS"
version: "0.3.0.dev2608010961051894"
version: "0.3.0.dev2608080910933529"
slug: "eos"
description: "Akkudoktor-EOS add-on"
url: "https://github.com/Akkudoktor-EOS/EOS"
+1 -1
View File
@@ -1,6 +1,6 @@
# Akkudoktor-EOS
**Version**: `v0.3.0.dev2608071015082558`
**Version**: `v0.3.0.dev2608080910933529`
<!-- pyml disable line-length -->
**Description**: This project provides a comprehensive solution for simulating and optimizing an energy system based on renewable energy sources. With a focus on photovoltaic (PV) systems, battery storage (batteries), load management (consumer requirements), heat pumps, electric vehicles, and consideration of electricity price data, this system enables forecasting and optimization of energy flow and costs over a specified period.
+1 -1
View File
@@ -8,7 +8,7 @@
"name": "Apache 2.0",
"url": "https://www.apache.org/licenses/LICENSE-2.0.html"
},
"version": "v0.3.0.dev2608071015082558"
"version": "v0.3.0.dev2608080910933529"
},
"paths": {
"/v1/admin/cache/clear": {
+10 -1
View File
@@ -263,7 +263,16 @@ class EnergyManagement(
# Update the predictions
logger.info("Starting energy management prediction update.")
await self.prediction.update_data(force_enable=force_enable, force_update=force_update)
try:
await self.prediction.update_data(
force_enable=force_enable, force_update=force_update
)
except Exception as e:
trace = "".join(traceback.TracebackException.from_exception(e).format())
error_msg = (
f"Prediction update failed - phase {EnergyManagement._stage}:\n{e}\n{trace}"
)
logger.error(error_msg)
if mode == EnergyManagementMode.PREDICTION:
logger.info("Energy management run done (predictions updated)")