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
+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)")