Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to fix RFID handling for “Duo” chargepoints, especially around resetting partner chargepoint state (RFID + timestamp) and switching back to the default vehicle in scenarios where scanning/plugging happens in different orders.
Changes:
- Extend
_link_rfid_to_cpto clear the duo partner’s RFID state (and optionally reset partner EV/manual-lock behavior). - Adjust
_validate_rfidlogic to reset the configured EV based on the EV’sload_defaultsetting. - Update/extend the existing unit test setup to include required template/module/EV objects for the new duo-path.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| packages/control/chargepoint/rfid.py | Adds duo-partner reset logic and updates EV reset decision logic in RFID validation. |
| packages/control/chargepoint/rfd_test.py | Extends test fixture/setup to exercise the updated duo logic path. |
Comments suppressed due to low confidence (1)
packages/control/chargepoint/rfd_test.py:57
- The test sets up ev/template/module so the new duo-reset branch runs, but it only asserts cp.data.set.rfid. The newly added behavior (clearing the partner’s RFID/timestamp, reverting partner EV to default when load_default is set, and clearing the partner module RFID) isn’t asserted, so regressions could slip through. Add assertions on cp1’s state and the relevant Mock clear_rfid/pub calls for the cases that enter the new branch.
cp.data.set.plug_time = cp0_plug_time
data.data.cp_data["cp1"].data.get.plug_state = cp1_plug_state
data.data.cp_data["cp1"].data.set.plug_time = cp1_plug_time
data.data.cp_data["cp1"].data.config.ev = 1
data.data.ev_data["ev1"] = Ev(1)
mock_find_duo_partner = Mock(return_value=partner_id)
monkeypatch.setattr(Chargepoint, "find_duo_partner", mock_find_duo_partner)
# execution
cp._link_rfid_to_cp()
# evaluation
assert cp.data.set.rfid == expected_set_rfid
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Tag kann nur an einem Duo-Ladepunkt zugewiesen werden | ||
| if cp2_data.template.data.disable_after_unplug: | ||
| cp2_data.data.set.manual_lock = True | ||
| if data.data.ev_data[f"ev{cp2_data.data.config.ev}"].charge_template.data.load_default: |
Comment on lines
+31
to
+39
| if cp2_data.template.data.disable_after_unplug: | ||
| cp2_data.data.set.manual_lock = True | ||
| if data.data.ev_data[f"ev{cp2_data.data.config.ev}"].charge_template.data.load_default: | ||
| cp2_data.data.config.ev = 0 | ||
| cp2_data.data.get.rfid = None | ||
| Pub().pub(f"openWB/set/chargepoint/{cp2_num}/get/rfid", None) | ||
| cp2_data.data.get.rfid_timestamp = None | ||
| Pub().pub(f"openWB/set/chargepoint/{cp2_num}/get/rfid_timestamp", None) | ||
| cp2_data.chargepoint_module.clear_rfid() |
| if self.template.data.disable_after_unplug: | ||
| self.data.set.manual_lock = True | ||
| if self.data.set.charging_ev_data.charge_template.data.load_default: | ||
| if data.data.ev_data[f"ev{self.data.config.ev}"].charge_template.data.load_default: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Standard:
Duo
Standard: