Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion packages/helpermodules/update_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@

class UpdateConfig:

DATASTORE_VERSION = 106
DATASTORE_VERSION = 107

valid_topic = [
"^openWB/bat/config/bat_control_permitted$",
Expand Down Expand Up @@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down