Skip to content

optional reset of the manual SoC#3211

Open
LKuemmel wants to merge 3 commits intoopenWB:masterfrom
LKuemmel:reset_manual_soc
Open

optional reset of the manual SoC#3211
LKuemmel wants to merge 3 commits intoopenWB:masterfrom
LKuemmel:reset_manual_soc

Conversation

@LKuemmel
Copy link
Contributor

@LKuemmel LKuemmel requested a review from Copilot March 17, 2026 06:44
@LKuemmel LKuemmel changed the title Reset manual soc optional reset of the manual SoC Mar 17, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 (default False).
  • Bump datastore version and add upgrade_datastore_113 to backfill reset_after_unplug for 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_ev earlier in update()).

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.

Comment on lines +199 to +201
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)
Comment on lines +2866 to +2868
if payload.get("type") == "manual" and payload["configuration"].get("reset_after_unplug") is None:
payload["configuration"]["reset_after_unplug"] = False
return {topic: payload}
Comment on lines +199 to +200
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)
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_unplug to the manual SoC module configuration (default False).
  • Add datastore migration v113 to backfill reset_after_unplug for 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):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants