Conversation
There was a problem hiding this comment.
Pull request overview
Adds support for optionally resetting the manual vehicle SoC after unplug, including configuration plumbing and a datastore migration so existing manual-SoC configs gain the new flag.
Changes:
- Extend the manual SoC module configuration with
reset_after_unplug(defaultFalse). - Bump datastore version and add
upgrade_datastore_113to backfillreset_after_unplugfor existing manual vehicle configs. - On unplug, publish a reset for the manual SoC when the flag is enabled (plus a small refactor to compute
charging_evearlier inupdate()).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| packages/modules/vehicles/manual/config.py | Adds reset_after_unplug to the manual SoC module’s configuration object. |
| packages/helpermodules/update_config.py | Bumps datastore version to 113 and adds an upgrade step to populate reset_after_unplug. |
| packages/control/chargepoint/chargepoint.py | Resets manual SoC on unplug when enabled; minor refactor in update() to resolve charging_ev earlier. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| if (self.data.set.charging_ev_data.soc_module is not None and | ||
| self.data.set.charging_ev_data.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 payload.get("type") == "manual" and payload["configuration"].get("reset_after_unplug") is None: | ||
| payload["configuration"]["reset_after_unplug"] = False | ||
| return {topic: payload} |
| if (self.data.set.charging_ev_data.soc_module is not None and | ||
| self.data.set.charging_ev_data.soc_module.vehicle_config.configuration.reset_after_unplug): |
| data.data.ev_data["ev"+str(self.data.config.ev)].charge_template) | ||
| if (self.data.set.charging_ev_data.soc_module is not None and | ||
| self.data.set.charging_ev_data.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) |
There was a problem hiding this comment.
Pull request overview
Adds a new optional behavior for the manual vehicle SoC module to reset the manually set SoC after unplugging, including datastore migration and updated tests to cover the new behavior and updated Chargepoint.update() call sites.
Changes:
- Add
reset_after_unplugto the manual SoC module configuration (defaultFalse). - Add datastore migration v113 to backfill
reset_after_unplugfor existing manual SoC configs. - Update chargepoint logic to publish a manual SoC reset on unplug (when enabled) and adjust/extend unit tests accordingly.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/modules/vehicles/manual/config.py | Introduces reset_after_unplug option on manual SoC configuration. |
| packages/helpermodules/update_config.py | Bumps datastore version to 113 and migrates manual SoC configs to include reset_after_unplug=False when missing. |
| packages/control/ocpp_test.py | Fixes test setup to pass an EV dict into Chargepoint.update() and sets cp.data.config.ev. |
| packages/control/chargepoint/chargepoint_test.py | Adds coverage for resetting manual SoC on unplug depending on the new config flag. |
| packages/control/chargepoint/chargepoint.py | Implements optional manual SoC reset publish on unplug; also moves _get_charging_ev() earlier in update(). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| # 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): |
openWB/openwb-ui-settings#924