diff --git a/packages/control/ev.py b/packages/control/ev.py index cc2fa0aba9..dd47350a1b 100644 --- a/packages/control/ev.py +++ b/packages/control/ev.py @@ -206,7 +206,7 @@ def soc_interval_expired(self, vehicle_update_data: VehicleUpdateData) -> bool: else: interval = self.soc_module.general_config.request_interval_not_charging # Zeitstempel prüfen, ob wieder abgefragt werden muss. - if timecheck.check_timestamp(self.data.get.soc_timestamp, interval*60-5) is False: + if timecheck.check_timestamp(self.data.get.soc_timestamp, interval-5) is False: # Zeit ist abgelaufen request_soc = True return request_soc @@ -771,7 +771,7 @@ def scheduled_charging_calc_current(self, phases = control_parameter_phases elif limit.selected == "amount" and used_amount >= limit.amount: message = self.SCHEDULED_CHARGING_REACHED_AMOUNT - elif 0 - soc_request_intervall_offset*60 < plan_data.remaining_time < 300 + soc_request_intervall_offset*60: + elif 0 - soc_request_intervall_offset < plan_data.remaining_time < 300 + soc_request_intervall_offset: # 5 Min vor spätestem Ladestart if limit.selected == "soc": limit_string = self.SCHEDULED_CHARGING_LIMITED_BY_SOC.format(limit.soc_scheduled) @@ -783,7 +783,7 @@ def scheduled_charging_calc_current(self, mode = "instant_charging" # weniger als die berechnete Zeit verfügbar # Ladestart wurde um maximal 20 Min verpasst. - elif plan_data.remaining_time <= 0 - soc_request_intervall_offset*60: + elif plan_data.remaining_time <= 0 - soc_request_intervall_offset: current = min(plan_data.missing_amount/(plan_data.duration + plan_data.remaining_time/3600)/(phases*230), plan_data.max_current) message = self.SCHEDULED_CHARGING_MAX_CURRENT.format(round(current, 2)) diff --git a/packages/helpermodules/update_config.py b/packages/helpermodules/update_config.py index 06410b323e..2e3d62f340 100644 --- a/packages/helpermodules/update_config.py +++ b/packages/helpermodules/update_config.py @@ -32,7 +32,7 @@ class UpdateConfig: - DATASTORE_VERSION = 29 + DATASTORE_VERSION = 30 valid_topic = [ "^openWB/bat/config/configured$", "^openWB/bat/set/charging_power_left$", @@ -1053,3 +1053,14 @@ def upgrade(topic: str, payload) -> None: Pub().pub(topic.replace("openWB/", "openWB/set/"), payload) self._loop_all_received_topics(upgrade) Pub().pub("openWB/system/datastore_version", 29) + + def upgrade_datastore_29(self) -> None: + def upgrade(topic: str, payload) -> None: + if re.search("openWB/vehicle/[0-9]+/soc_module/general_config", topic) is not None: + payload = decode_payload(payload) + # Zeitangabe in s + payload["request_interval_charging"] = payload["request_interval_charging"]*60 + payload["request_interval_not_charging"] = payload["request_interval_not_charging"]*60 + Pub().pub(topic.replace("openWB/", "openWB/set/"), payload) + self._loop_all_received_topics(upgrade) + Pub().pub("openWB/system/datastore_version", 30) diff --git a/packages/modules/common/abstract_vehicle.py b/packages/modules/common/abstract_vehicle.py index fc434cb08c..206f7a52ff 100644 --- a/packages/modules/common/abstract_vehicle.py +++ b/packages/modules/common/abstract_vehicle.py @@ -16,8 +16,8 @@ class VehicleUpdateData: @dataclass class GeneralVehicleConfig: use_soc_from_cp: bool = False - request_interval_charging: int = 5 - request_interval_not_charging: int = 720 + request_interval_charging: int = 300 + request_interval_not_charging: int = 43200 request_only_plugged: bool = False