From d347e9a8d55aa4f36c4d1851dc844fdf40a70d5d Mon Sep 17 00:00:00 2001 From: LKuemmel Date: Fri, 19 Dec 2025 12:32:11 +0100 Subject: [PATCH] Awattar: fix factor --- packages/helpermodules/update_config.py | 14 +++++++++++++- .../flexible_tariffs/awattar/config.py | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/helpermodules/update_config.py b/packages/helpermodules/update_config.py index a4791b4962..15530c627d 100644 --- a/packages/helpermodules/update_config.py +++ b/packages/helpermodules/update_config.py @@ -57,7 +57,7 @@ class UpdateConfig: - DATASTORE_VERSION = 106 + DATASTORE_VERSION = 107 valid_topic = [ "^openWB/bat/config/bat_control_permitted$", @@ -2689,3 +2689,15 @@ def upgrade(topic: str, payload) -> None: return {topic: config} self._loop_all_received_topics(upgrade) self._append_datastore_version(106) + + def upgrade_datastore_107(self) -> None: + def upgrade(topic: str, payload) -> None: + if re.search("openWB/optional/ep/flexible_tariff/provider", topic) is not None: + provider = decode_payload(payload) + if provider.get("type") == "awattar": + if provider["configuration"].get("fix") is not None and provider["configuration"]["fix"] > 0.005: + # convert fix from ct/kWh to €/kWh + provider["configuration"]["fix"] = round(provider["configuration"]["fix"] / 1000.0, 7) + return {topic: provider} + self._loop_all_received_topics(upgrade) + self._append_datastore_version(107) diff --git a/packages/modules/electricity_pricing/flexible_tariffs/awattar/config.py b/packages/modules/electricity_pricing/flexible_tariffs/awattar/config.py index 6758b848a9..77f87d5805 100644 --- a/packages/modules/electricity_pricing/flexible_tariffs/awattar/config.py +++ b/packages/modules/electricity_pricing/flexible_tariffs/awattar/config.py @@ -2,7 +2,7 @@ class AwattarTariffConfiguration: def __init__(self, country: str = "de", net: bool = True, - fix: float = 0.015, + fix: float = 0.000015, proportional: float = 3, tax: float = 20) -> None: self.country = country