Repository navigation
fix load default after unplug #3309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -187,22 +187,23 @@ def _process_charge_stop(self) -> None: | |
| self.reset_control_parameter_at_charge_stop() | ||
| data.data.counter_all_data.get_evu_counter().reset_switch_on_off(self) | ||
| if self.data.get.plug_state is False and self.data.set.plug_state_prev is True: | ||
| chargelog.save_and_reset_data(self, data.data.ev_data["ev"+str(self.data.config.ev)]) | ||
| charging_ev = data.data.ev_data[f"ev{self.data.config.ev}"] | ||
| chargelog.save_and_reset_data(self, charging_ev) | ||
| self.data.control_parameter = control_parameter_factory() | ||
| # VOR Standard nach Abstecken | ||
| if (self.data.set.charging_ev_data.soc_module is not None and | ||
| self.data.set.charging_ev_data.soc_module.vehicle_config.type == "manual" and | ||
| self.data.set.charging_ev_data.soc_module.vehicle_config.configuration.reset_after_unplug): | ||
| if (charging_ev.soc_module is not None and | ||
| charging_ev.soc_module.vehicle_config.type == "manual" and | ||
| charging_ev.soc_module.vehicle_config.configuration.reset_after_unplug): | ||
| Pub().pub(f"openWB/set/vehicle/{self.data.config.ev}/soc_module/calculated_soc_state/manual_soc", 0) | ||
| if self.data.set.charge_template.data.load_default: | ||
| self.data.config.ev = 0 | ||
| if self.template.data.disable_after_unplug: | ||
| self.data.set.manual_lock = True | ||
| log.debug("/set/manual_lock True") | ||
| # NACH Standard nach Abstecken | ||
| ev_after_load_default = data.data.ev_data[f"ev{self.data.config.ev}"] | ||
| if data.data.general_data.data.temporary_charge_templates_active: | ||
| self.update_charge_template( | ||
| data.data.ev_data["ev"+str(self.data.config.ev)].charge_template) | ||
| self.update_charge_template(ev_after_load_default.charge_template) | ||
|
|
||
| self.data.set.rfid = None | ||
| self.data.set.plug_time = None | ||
|
|
@@ -635,12 +636,12 @@ def update(self, ev_list: Dict[str, Ev]) -> None: | |
| vehicle, message_ev = self.template.get_ev(self.data.set.rfid or self.data.get.rfid, | ||
| self.data.get.vehicle_id, | ||
| self.data.config.ev) | ||
| charging_ev = self._get_charging_ev(vehicle, ev_list) | ||
| if message_ev: | ||
| message += message_ev | ||
|
|
||
| if charging_possible: | ||
| try: | ||
| charging_ev = self._get_charging_ev(vehicle, ev_list) | ||
| state, message_ev, submode, required_current, template_phases = charging_ev.get_required_current( | ||
|
Comment on lines
643
to
645
|
||
| self.data.set.charge_template, | ||
| self.data.control_parameter, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By moving
_get_charging_ev(vehicle, ev_list)insideif charging_possible,self.data.set.charging_ev_datais no longer updated on cycles where charging is blocked (e.g., manual lock/autolock while plugged). This object is still used later inupdate()(e.g., the SoC timestamp comparison againstself.data.set.charging_ev_data.data.get.soc_timestamp), so it can become stale and reference the wrong EV. Consider calling_get_charging_evbefore thecharging_possiblebranch (as before) or otherwise ensuringcharging_ev_datastays in sync with the resolvedvehicleeven when charging is not allowed.