From 8bf6973023c38ba3ff96fa8fb7019c885c10ea17 Mon Sep 17 00:00:00 2001 From: LKuemmel Date: Thu, 17 Oct 2024 16:04:47 +0200 Subject: [PATCH 1/6] draft --- packages/control/ev/charge_template.py | 28 ++++++++++----------- packages/control/ev/charge_template_test.py | 2 +- packages/control/ev/ev.py | 15 ++++++----- packages/helpermodules/abstract_plans.py | 4 ++- packages/helpermodules/command.py | 10 +++++--- packages/helpermodules/update_config.py | 9 +++++++ 6 files changed, 40 insertions(+), 28 deletions(-) diff --git a/packages/control/ev/charge_template.py b/packages/control/ev/charge_template.py index 2d2bba881e..ed0493350c 100644 --- a/packages/control/ev/charge_template.py +++ b/packages/control/ev/charge_template.py @@ -117,7 +117,7 @@ class SelectedPlan: max_current: int = 16 missing_amount: float = 0 phases: int = 1 - num: int = 0 + id: int = 0 @dataclass @@ -150,22 +150,22 @@ def time_charging(self, current = plan.current if charging_type == ChargingType.AC.value else plan.dc_current if self.data.et.active and data.data.optional_data.et_provider_available(): if not data.data.optional_data.et_price_lower_than_limit(self.data.et.max_price): - return 0, "stop", self.CHARGING_PRICE_EXCEEDED, plan.name + return 0, "stop", self.CHARGING_PRICE_EXCEEDED, plan.id if plan.limit.selected == "none": # kein Limit konfiguriert, mit konfigurierter Stromstärke laden - return current, "time_charging", message, plan.name + return current, "time_charging", message, plan.id elif plan.limit.selected == "soc": # SoC Limit konfiguriert if soc: if soc < plan.limit.soc: - return current, "time_charging", message, plan.name # Limit nicht erreicht + return current, "time_charging", message, plan.id # Limit nicht erreicht else: - return 0, "stop", self.TIME_CHARGING_SOC_REACHED, plan.name # Limit erreicht + return 0, "stop", self.TIME_CHARGING_SOC_REACHED, plan.id # Limit erreicht else: - return plan.current, "time_charging", message, plan.name + return plan.current, "time_charging", message, plan.id elif plan.limit.selected == "amount": # Energiemengenlimit konfiguriert if used_amount_time_charging < plan.limit.amount: - return current, "time_charging", message, plan.name # Limit nicht erreicht + return current, "time_charging", message, plan.id # Limit nicht erreicht else: - return 0, "stop", self.TIME_CHARGING_AMOUNT_REACHED, plan.name # Limit erreicht + return 0, "stop", self.TIME_CHARGING_AMOUNT_REACHED, plan.id # Limit erreicht else: raise TypeError(f'{plan.limit.selected} unbekanntes Zeitladen-Limit.') else: @@ -260,7 +260,7 @@ def scheduled_charging_recent_plan(self, used_amount: float, max_phases: int, phase_switch_supported: bool, - charging_type: str) -> Tuple[Optional[SelectedPlan], float]: + charging_type: str) -> Optional[SelectedPlan]: """ prüft, ob der Ziel-SoC oder die Ziel-Energiemenge erreicht wurde und stellt den zur Erreichung nötigen Ladestrom ein. Um etwas mehr Puffer zu haben, wird bis 20 Min nach dem Zieltermin noch geladen, wenn dieser nicht eingehalten werden konnte. @@ -310,7 +310,7 @@ def _search_plan(self, missed_date_today_of_plan_with_smallest_remaining_time = False plan_data: Optional[SelectedPlan] = None battery_capacity = ev_template.data.battery_capacity - for num, plan in self.data.chargemode.scheduled_charging.plans.items(): + for plan in self.data.chargemode.scheduled_charging.plans.values(): if plan.active: if plan.limit.selected == "soc" and soc is None: raise ValueError("Um Zielladen mit SoC-Ziel nutzen zu können, bitte ein SoC-Modul konfigurieren " @@ -341,10 +341,10 @@ def _search_plan(self, available_current=available_current, max_current=max_current, phases=phases, - num=num, + id=plan.id, missing_amount=missing_amount, duration=duration) - log.debug(f"Plan-Nr. {num}: Differenz zum Start {remaining_time}s, Dauer {duration/3600}h, " + log.debug(f"Plan-Nr. {plan.id}: Differenz zum Start {remaining_time}s, Dauer {duration/3600}h, " f"Termin heute verpasst: {missed_date_today}") except Exception: log.exception("Fehler im ev-Modul "+str(self.ct_num)) @@ -380,7 +380,7 @@ def _calculate_duration(self, SCHEDULED_CHARGING_REACHED_SCHEDULED_SOC = ("Falls vorhanden wird mit EVU-Überschuss geladen, da der Ziel-Soc " "für Zielladen bereits erreicht wurde.") SCHEDULED_CHARGING_NO_PLANS_CONFIGURED = "Keine Ladung, da keine Ziel-Termine konfiguriert sind." - SCHEDULED_CHARGING_NO_DATE_PENDING = "Kein Zielladen, da kein Ziel-Termin in den nächsten 24 Stunden ansteht." + SCHEDULED_CHARGING_NO_DATE_PENDING = "Kein Zielladen, da kein Ziel-Termin ansteht." SCHEDULED_CHARGING_USE_PV = ("Kein Zielladen, da noch Zeit bis zum Zieltermin ist. Falls vorhanden, " "wird mit Überschuss geladen.") SCHEDULED_CHARGING_MAX_CURRENT = ("Zielladen mit {}A. Der Ladestrom wurde erhöht, um den Zieltermin zu erreichen. " @@ -407,7 +407,7 @@ def scheduled_charging_calc_current(self, return current, submode, self.SCHEDULED_CHARGING_NO_PLANS_CONFIGURED, control_parameter_phases else: return current, submode, self.SCHEDULED_CHARGING_NO_DATE_PENDING, control_parameter_phases - current_plan = self.data.chargemode.scheduled_charging.plans[plan_data.num] + current_plan = self.data.chargemode.scheduled_charging.plans[str(plan_data.id)] limit = current_plan.limit phases = plan_data.phases log.debug("Verwendeter Plan: "+str(current_plan.name)) diff --git a/packages/control/ev/charge_template_test.py b/packages/control/ev/charge_template_test.py index 6425eada6b..fdb18a2867 100644 --- a/packages/control/ev/charge_template_test.py +++ b/packages/control/ev/charge_template_test.py @@ -211,7 +211,7 @@ def test_search_plan(check_duration_return1: Tuple[Optional[float], bool], if expected_plan_num is None: assert plan_data is None else: - assert plan_data.num == expected_plan_num + assert plan_data.id == expected_plan_num assert plan_data.duration == 100 diff --git a/packages/control/ev/ev.py b/packages/control/ev/ev.py index 61ae01dc51..71f67b31e3 100644 --- a/packages/control/ev/ev.py +++ b/packages/control/ev/ev.py @@ -156,19 +156,18 @@ def get_required_current(self, charging_type) soc_request_interval_offset = 0 if plan_data: - name = self.charge_template.data.chargemode.scheduled_charging.plans[plan_data.num].name # Wenn mit einem neuen Plan geladen wird, muss auch die Energiemenge von neuem gezählt werden. - if (self.charge_template.data.chargemode.scheduled_charging.plans[plan_data.num].limit. + if (self.charge_template.data.chargemode.scheduled_charging.plans[str(plan_data.id)].limit. selected == "amount" and - name != control_parameter.current_plan): + plan_data.id != control_parameter.current_plan): control_parameter.imported_at_plan_start = imported # Wenn der SoC ein paar Minuten alt ist, kann der Termin trotzdem gehalten werden. # Zielladen kann nicht genauer arbeiten, als das Abfrageintervall vom SoC. if (self.soc_module and self.charge_template.data.chargemode. - scheduled_charging.plans[plan_data.num].limit.selected == "soc"): + scheduled_charging.plans[str(plan_data.id)].limit.selected == "soc"): soc_request_interval_offset = self.soc_module.general_config.request_interval_charging - control_parameter.current_plan = name + control_parameter.current_plan = plan_data.id else: control_parameter.current_plan = None required_current, submode, message, phases = self.charge_template.scheduled_charging_calc_current( @@ -185,7 +184,7 @@ def get_required_current(self, if control_parameter.imported_at_plan_start is None: control_parameter.imported_at_plan_start = imported used_amount = imported - control_parameter.imported_at_plan_start - tmp_current, tmp_submode, tmp_message, name = self.charge_template.time_charging( + tmp_current, tmp_submode, tmp_message, plan_id = self.charge_template.time_charging( self.data.get.soc, used_amount, charging_type @@ -193,9 +192,9 @@ def get_required_current(self, # Info vom Zielladen erhalten message = f"{message or ''} {tmp_message or ''}".strip() if tmp_current > 0: - control_parameter.current_plan = name + control_parameter.current_plan = plan_id # Wenn mit einem neuen Plan geladen wird, muss auch die Energiemenge von neuem gezählt werden. - if name != control_parameter.current_plan: + if plan_id != control_parameter.current_plan: control_parameter.imported_at_plan_start = imported required_current = tmp_current submode = tmp_submode diff --git a/packages/helpermodules/abstract_plans.py b/packages/helpermodules/abstract_plans.py index b690c0a20f..04ff4538b1 100644 --- a/packages/helpermodules/abstract_plans.py +++ b/packages/helpermodules/abstract_plans.py @@ -1,5 +1,5 @@ from dataclasses import dataclass, field -from typing import List +from typing import List, Optional def once_factory() -> List: @@ -63,6 +63,7 @@ class TimeframePlan(PlanBase): class ScheduledChargingPlan(PlanBase): current: int = 14 dc_current: float = 145 + id: Optional[int] = None name: str = "neuer Zielladen-Plan" limit: ScheduledLimit = field(default_factory=scheduled_limit_factory) time: str = "07:00" # ToDo: aktuelle Zeit verwenden @@ -73,6 +74,7 @@ class TimeChargingPlan(TimeframePlan): name: str = "neuer Zeitladen-Plan" current: int = 16 dc_current: float = 145 + id: Optional[int] = None limit: Limit = field(default_factory=limit_factory) diff --git a/packages/helpermodules/command.py b/packages/helpermodules/command.py index 3f6658d447..813f781ef4 100644 --- a/packages/helpermodules/command.py +++ b/packages/helpermodules/command.py @@ -363,11 +363,12 @@ def addChargeTemplateSchedulePlan(self, connection_id: str, payload: dict) -> No """ sendet das Topic, zu dem ein neuer Zielladen-Plan erstellt werden soll. """ new_id = self.max_id_charge_template_scheduled_plan + 1 - charge_template_default = dataclass_utils.asdict(ev.ScheduledChargingPlan()) + charge_template_default = ev.ScheduledChargingPlan() + charge_template_default.id = new_id Pub().pub( f'openWB/set/vehicle/template/charge_template/{payload["data"]["template"]}' f'/chargemode/scheduled_charging/plans/{new_id}', - charge_template_default) + dataclass_utils.asdict(charge_template_default)) self.max_id_charge_template_scheduled_plan = new_id Pub().pub( "openWB/set/command/max_id/charge_template_scheduled_plan", new_id) @@ -399,11 +400,12 @@ def addChargeTemplateTimeChargingPlan(self, connection_id: str, payload: dict) - """ sendet das Topic, zu dem ein neuer Zeitladen-Plan erstellt werden soll. """ new_id = self.max_id_charge_template_time_charging_plan + 1 - time_charging_plan_default = dataclass_utils.asdict(ev.TimeChargingPlan()) + time_charging_plan_default = ev.TimeChargingPlan() + time_charging_plan_default.id = new_id Pub().pub( f'openWB/set/vehicle/template/charge_template/{payload["data"]["template"]}' f'/time_charging/plans/{new_id}', - time_charging_plan_default) + dataclass_utils.asdict(time_charging_plan_default)) self.max_id_charge_template_time_charging_plan = new_id Pub().pub( "openWB/set/command/max_id/charge_template_time_charging_plan", new_id) diff --git a/packages/helpermodules/update_config.py b/packages/helpermodules/update_config.py index e88899638c..c824c1278c 100644 --- a/packages/helpermodules/update_config.py +++ b/packages/helpermodules/update_config.py @@ -1890,3 +1890,12 @@ def upgrade(topic: str, payload) -> None: return {component_topic: config_payload} self._loop_all_received_topics(upgrade) self.__update_topic("openWB/system/datastore_version", 69) + + def upgrade_datastore_69(self) -> None: + def upgrade(topic: str, payload) -> Optional[dict]: + if (re.search("openWB/vehicle/template/charge_template/[0-9]+/chargemode/scheduled_charging/plans/[0-9]+", topic) is not None): + payload = decode_payload(payload) + payload["id"] = int(get_second_index(topic)) + return {topic: payload} + self._loop_all_received_topics(upgrade) + self.__update_topic("openWB/system/datastore_version", 70) From d6f74cab3eb9ee5e65eecb82d425a6ce9829af2c Mon Sep 17 00:00:00 2001 From: LKuemmel Date: Fri, 27 Dec 2024 08:03:59 +0100 Subject: [PATCH 2/6] fixes --- packages/control/ev/ev.py | 2 +- packages/helpermodules/update_config.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/control/ev/ev.py b/packages/control/ev/ev.py index 71f67b31e3..2f31fd1425 100644 --- a/packages/control/ev/ev.py +++ b/packages/control/ev/ev.py @@ -192,10 +192,10 @@ def get_required_current(self, # Info vom Zielladen erhalten message = f"{message or ''} {tmp_message or ''}".strip() if tmp_current > 0: - control_parameter.current_plan = plan_id # Wenn mit einem neuen Plan geladen wird, muss auch die Energiemenge von neuem gezählt werden. if plan_id != control_parameter.current_plan: control_parameter.imported_at_plan_start = imported + control_parameter.current_plan = plan_id required_current = tmp_current submode = tmp_submode if (required_current == 0) or (required_current is None): diff --git a/packages/helpermodules/update_config.py b/packages/helpermodules/update_config.py index c824c1278c..20f0fb96e1 100644 --- a/packages/helpermodules/update_config.py +++ b/packages/helpermodules/update_config.py @@ -1893,7 +1893,8 @@ def upgrade(topic: str, payload) -> None: def upgrade_datastore_69(self) -> None: def upgrade(topic: str, payload) -> Optional[dict]: - if (re.search("openWB/vehicle/template/charge_template/[0-9]+/chargemode/scheduled_charging/plans/[0-9]+", topic) is not None): + if (re.search("openWB/vehicle/template/charge_template/[0-9]+/chargemode/scheduled_charging/plans/[0-9]+", topic) is not None or + re.search("openWB/vehicle/template/charge_template/[0-9]+/time_charging/plans/[0-9]+", topic) is not None): payload = decode_payload(payload) payload["id"] = int(get_second_index(topic)) return {topic: payload} From a092e9a0ce820c88ed816c95eef10124b423f466 Mon Sep 17 00:00:00 2001 From: LKuemmel Date: Fri, 3 Jan 2025 08:40:00 +0100 Subject: [PATCH 3/6] flake8 --- packages/helpermodules/update_config.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/helpermodules/update_config.py b/packages/helpermodules/update_config.py index 20f0fb96e1..85a058176f 100644 --- a/packages/helpermodules/update_config.py +++ b/packages/helpermodules/update_config.py @@ -1893,8 +1893,10 @@ def upgrade(topic: str, payload) -> None: def upgrade_datastore_69(self) -> None: def upgrade(topic: str, payload) -> Optional[dict]: - if (re.search("openWB/vehicle/template/charge_template/[0-9]+/chargemode/scheduled_charging/plans/[0-9]+", topic) is not None or - re.search("openWB/vehicle/template/charge_template/[0-9]+/time_charging/plans/[0-9]+", topic) is not None): + if (re.search("openWB/vehicle/template/charge_template/[0-9]+/chargemode/scheduled_charging/plans/[0-9]+", + topic) is not None or + re.search("openWB/vehicle/template/charge_template/[0-9]+/time_charging/plans/[0-9]+", + topic) is not None): payload = decode_payload(payload) payload["id"] = int(get_second_index(topic)) return {topic: payload} From f8c21c8ad4776d84aee2685e56a6d05baf2e59c5 Mon Sep 17 00:00:00 2001 From: LKuemmel Date: Fri, 3 Jan 2025 08:41:35 +0100 Subject: [PATCH 4/6] fix rebase --- packages/helpermodules/update_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/helpermodules/update_config.py b/packages/helpermodules/update_config.py index 85a058176f..6b8faa8d0e 100644 --- a/packages/helpermodules/update_config.py +++ b/packages/helpermodules/update_config.py @@ -51,7 +51,7 @@ class UpdateConfig: - DATASTORE_VERSION = 69 + DATASTORE_VERSION = 70 valid_topic = [ "^openWB/bat/config/configured$", "^openWB/bat/config/power_limit_mode$", From 9be5636fad1f4fffe7f24c74602970fa73ae66a0 Mon Sep 17 00:00:00 2001 From: LKuemmel Date: Fri, 3 Jan 2025 08:57:05 +0100 Subject: [PATCH 5/6] fix test --- packages/control/ev/charge_template_test.py | 50 +++++++++++---------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/packages/control/ev/charge_template_test.py b/packages/control/ev/charge_template_test.py index fdb18a2867..a036ffed0a 100644 --- a/packages/control/ev/charge_template_test.py +++ b/packages/control/ev/charge_template_test.py @@ -26,29 +26,29 @@ def data_module() -> None: [ pytest.param({}, 0, 0, None, (0, "stop", ChargeTemplate.TIME_CHARGING_NO_PLAN_CONFIGURED, None), id="no plan defined"), - pytest.param({"0": TimeChargingPlan()}, 0, 0, None, + pytest.param({"0": TimeChargingPlan(id=0)}, 0, 0, None, (0, "stop", ChargeTemplate.TIME_CHARGING_NO_PLAN_ACTIVE, None), id="no plan active"), - pytest.param({"0": TimeChargingPlan()}, 0, 0, TimeChargingPlan(), - (16, "time_charging", None, "neuer Zeitladen-Plan"), id="plan active"), - pytest.param({"0": TimeChargingPlan(limit=Limit(selected="soc"))}, 100, 0, - TimeChargingPlan(limit=Limit(selected="soc")), - (0, "stop", ChargeTemplate.TIME_CHARGING_SOC_REACHED, "neuer Zeitladen-Plan"), + pytest.param({"0": TimeChargingPlan(id=0)}, 0, 0, TimeChargingPlan(id=0), + (16, "time_charging", None, 0), id="plan active"), + pytest.param({"0": TimeChargingPlan(id=0, limit=Limit(selected="soc"))}, 100, 0, + TimeChargingPlan(id=0, limit=Limit(selected="soc")), + (0, "stop", ChargeTemplate.TIME_CHARGING_SOC_REACHED, 0), id="plan active, soc is reached"), - pytest.param({"0": TimeChargingPlan(limit=Limit(selected="soc"))}, 40, 0, - TimeChargingPlan(limit=Limit(selected="soc")), - (16, "time_charging", None, "neuer Zeitladen-Plan"), id="plan active, soc is not reached"), - pytest.param({"0": TimeChargingPlan(limit=Limit(selected="soc"))}, None, 0, - TimeChargingPlan(limit=Limit(selected="soc")), - (16, "time_charging", None, "neuer Zeitladen-Plan"), id="plan active, soc is not defined"), - pytest.param({"0": TimeChargingPlan(limit=Limit(selected="amount"))}, 0, 1500, - TimeChargingPlan(limit=Limit(selected="amount")), - (0, "stop", ChargeTemplate.TIME_CHARGING_AMOUNT_REACHED, "neuer Zeitladen-Plan"), + pytest.param({"0": TimeChargingPlan(id=0, limit=Limit(selected="soc"))}, 40, 0, + TimeChargingPlan(id=0, limit=Limit(selected="soc")), + (16, "time_charging", None, 0), id="plan active, soc is not reached"), + pytest.param({"0": TimeChargingPlan(id=0, limit=Limit(selected="soc"))}, None, 0, + TimeChargingPlan(id=0, limit=Limit(selected="soc")), + (16, "time_charging", None, 0), id="plan active, soc is not defined"), + pytest.param({"0": TimeChargingPlan(id=0, limit=Limit(selected="amount"))}, 0, 1500, + TimeChargingPlan(id=0, limit=Limit(selected="amount")), + (0, "stop", ChargeTemplate.TIME_CHARGING_AMOUNT_REACHED, 0), id="plan active, used_amount_time_charging is reached"), - pytest.param({"0": TimeChargingPlan(limit=Limit(selected="amount"))}, 0, 500, - TimeChargingPlan(limit=Limit(selected="amount")), - (16, "time_charging", None, "neuer Zeitladen-Plan"), + pytest.param({"0": TimeChargingPlan(id=0, limit=Limit(selected="amount"))}, 0, 500, + TimeChargingPlan(id=0, limit=Limit(selected="amount")), + (16, "time_charging", None, 0), id="plan active, used_amount_time_charging is not reached"), - pytest.param({"0": TimeChargingPlan()}, 0, 0, None, + pytest.param({"0": TimeChargingPlan(id=0)}, 0, 0, None, (0, "stop", ChargeTemplate.TIME_CHARGING_NO_PLAN_ACTIVE, None), id="plan defined but not found"), ] ) @@ -202,8 +202,9 @@ def test_search_plan(check_duration_return1: Tuple[Optional[float], bool], check_duration_mock = Mock(side_effect=[check_duration_return1, check_duration_return2]) monkeypatch.setattr(timecheck, "check_duration", check_duration_mock) ct = ChargeTemplate(0) - plan_mock = Mock(spec=ScheduledChargingPlan, active=True, current=14, limit=Limit(selected="amount")) - ct.data.chargemode.scheduled_charging.plans = {0: plan_mock, 1: plan_mock} + plan_mock_0 = Mock(spec=ScheduledChargingPlan, active=True, current=14, id=0, limit=Limit(selected="amount")) + plan_mock_1 = Mock(spec=ScheduledChargingPlan, active=True, current=14, id=1, limit=Limit(selected="amount")) + ct.data.chargemode.scheduled_charging.plans = {"0": plan_mock_0, "1": plan_mock_1} # execution plan_data = ct._search_plan(14, 60, EvTemplate(), 3, 200, ChargingType.AC.value) @@ -252,9 +253,10 @@ def test_scheduled_charging_calc_current(plan_data: SelectedPlan, expected: Tuple[float, str, str, int]): # setup ct = ChargeTemplate(0) - plan = ScheduledChargingPlan(active=True) + plan = ScheduledChargingPlan(active=True, id=0) plan.limit.selected = selected - ct.data.chargemode.scheduled_charging.plans = {0: plan} + # json verwandelt Keys in strings + ct.data.chargemode.scheduled_charging.plans = {"0": plan} # execution ret = ct.scheduled_charging_calc_current(plan_data, soc, used_amount, 3, 6, 0) @@ -285,7 +287,7 @@ def test_scheduled_charging_calc_current_electricity_tariff(loading_hour, expect ct = ChargeTemplate(0) plan = ScheduledChargingPlan(active=True) plan.limit.selected = "soc" - ct.data.chargemode.scheduled_charging.plans = {0: plan} + ct.data.chargemode.scheduled_charging.plans = {"0": plan} ct.data.et.active = True mock_et_get_loading_hours = Mock(return_value=[]) monkeypatch.setattr(data.data.optional_data, "et_get_loading_hours", mock_et_get_loading_hours) From 7fcefe224f673d20828e49de743417ee5bd54404 Mon Sep 17 00:00:00 2001 From: LKuemmel Date: Fri, 3 Jan 2025 09:22:05 +0100 Subject: [PATCH 6/6] fix new plan --- packages/helpermodules/command.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/helpermodules/command.py b/packages/helpermodules/command.py index 813f781ef4..958731b23d 100644 --- a/packages/helpermodules/command.py +++ b/packages/helpermodules/command.py @@ -17,6 +17,7 @@ # ToDo: move to module commands if implemented from helpermodules import pub +from helpermodules.abstract_plans import ScheduledChargingPlan, TimeChargingPlan from helpermodules.utils.run_command import run_command from modules.backup_clouds.onedrive.api import generateMSALAuthCode, retrieveMSALTokens @@ -363,7 +364,7 @@ def addChargeTemplateSchedulePlan(self, connection_id: str, payload: dict) -> No """ sendet das Topic, zu dem ein neuer Zielladen-Plan erstellt werden soll. """ new_id = self.max_id_charge_template_scheduled_plan + 1 - charge_template_default = ev.ScheduledChargingPlan() + charge_template_default = ScheduledChargingPlan() charge_template_default.id = new_id Pub().pub( f'openWB/set/vehicle/template/charge_template/{payload["data"]["template"]}' @@ -400,7 +401,7 @@ def addChargeTemplateTimeChargingPlan(self, connection_id: str, payload: dict) - """ sendet das Topic, zu dem ein neuer Zeitladen-Plan erstellt werden soll. """ new_id = self.max_id_charge_template_time_charging_plan + 1 - time_charging_plan_default = ev.TimeChargingPlan() + time_charging_plan_default = TimeChargingPlan() time_charging_plan_default.id = new_id Pub().pub( f'openWB/set/vehicle/template/charge_template/{payload["data"]["template"]}'