From 1832364d60e47236e8f66a2d5d43a6f30d6cf7b2 Mon Sep 17 00:00:00 2001 From: Bobby Noelte Date: Sun, 8 Mar 2026 21:04:22 +0100 Subject: [PATCH] fix: pydantic datetime dataframe timezone conversion (#927) Signed-off-by: Bobby Noelte --- config.yaml | 2 +- docs/_generated/openapi.md | 2 +- openapi.json | 2 +- src/akkudoktoreos/core/pydantic.py | 8 ++++++-- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/config.yaml b/config.yaml index 9a2c9c1..4bac8a0 100644 --- a/config.yaml +++ b/config.yaml @@ -6,7 +6,7 @@ # the root directory (no add-on folder as usual). name: "Akkudoktor-EOS" -version: "0.2.0.dev2603032000228213" +version: "0.2.0.dev2603071785688456" slug: "eos" description: "Akkudoktor-EOS add-on" url: "https://github.com/Akkudoktor-EOS/EOS" diff --git a/docs/_generated/openapi.md b/docs/_generated/openapi.md index 69af270..a0eb648 100644 --- a/docs/_generated/openapi.md +++ b/docs/_generated/openapi.md @@ -1,6 +1,6 @@ # Akkudoktor-EOS -**Version**: `v0.2.0.dev2603032000228213` +**Version**: `v0.2.0.dev2603071785688456` **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. diff --git a/openapi.json b/openapi.json index c0dc673..176316d 100644 --- a/openapi.json +++ b/openapi.json @@ -8,7 +8,7 @@ "name": "Apache 2.0", "url": "https://www.apache.org/licenses/LICENSE-2.0.html" }, - "version": "v0.2.0.dev2603032000228213" + "version": "v0.2.0.dev2603071785688456" }, "paths": { "/v1/admin/cache/clear": { diff --git a/src/akkudoktoreos/core/pydantic.py b/src/akkudoktoreos/core/pydantic.py index dcce1b9..6ab672e 100644 --- a/src/akkudoktoreos/core/pydantic.py +++ b/src/akkudoktoreos/core/pydantic.py @@ -1136,9 +1136,13 @@ class PydanticDateTimeDataFrame(PydanticBaseModel): data_tz = cls._detect_data_tz(df) if tz is not None: - if data_tz and data_tz != tz: - raise ValueError(f"Timezone mismatch: tz='{tz}' but data uses '{data_tz}'") resolved_tz = tz + if data_tz and data_tz != tz: + warning_msg = ( + f"Forcing Pydantic dataframe timezone to '{resolved_tz}' - " + f"data timezone was '{data_tz}'." + ) + logger.warning(warning_msg) else: if data_tz: resolved_tz = data_tz