Skip to content

fix rfid duo#3300

Draft
LKuemmel wants to merge 1 commit intoopenWB:masterfrom
LKuemmel:fix_rfid
Draft

fix rfid duo#3300
LKuemmel wants to merge 1 commit intoopenWB:masterfrom
LKuemmel:fix_rfid

Conversation

@LKuemmel
Copy link
Copy Markdown
Contributor

Standard:

  • Scannen vor Anstecken
  • Scannen nach Anstecken
  • kein Anstecken nach Scannen -> wieder auf Standard-Fahrzeug wechseln, RFID und Zeitstempel zurücksetzen

Duo
Standard:

  • Lp 1: Scannen vor Anstecken, LP 2: wieder auf Standard-Fahrzeug wechseln, RFID und Zeitstempel zurücksetzen
  • LP 1: Scannen nach Anstecken, LP 2: wieder auf Standard-Fahrzeug wechseln, RFID und Zeitstempel zurücksetzen
  • LP 1: Scannen nach Anstecken, LP 2: wieder auf Standard-Fahrzeug wechseln, RFID und Zeitstempel zurücksetzen, LP 2 scannen und Anstecken
  • LP 1& 2: kein Anstecken nach Scannen -> wieder auf Standard-Fahrzeug wechseln, RFID und Zeitstempel zurücksetzen
  • Lp 2: Scannen vor Anstecken, LP 1: wieder auf Standard-Fahrzeug wechseln, RFID und Zeitstempel zurücksetzen
  • LP 2: Scannen nach Anstecken, LP 1: wieder auf Standard-Fahrzeug wechseln, RFID und Zeitstempel zurücksetzen
  • LP 2: Scannen nach Anstecken, LP 1: wieder auf Standard-Fahrzeug wechseln, RFID und Zeitstempel zurücksetzen, LP 1 scannen und Anstecken

Copy link
Copy Markdown
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

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_cp to clear the duo partner’s RFID state (and optionally reset partner EV/manual-lock behavior).
  • Adjust _validate_rfid logic to reset the configured EV based on the EV’s load_default setting.
  • 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:
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