Skip to content

Fix: CP retry firing every cycle - #4329

Open
seaspotter wants to merge 2 commits into
openWB:masterfrom
seaspotter:fix-cp-retry-timestamps
Open

seaspotter wants to merge 2 commits into
openWB:masterfrom
seaspotter:fix-cp-retry-timestamps

Conversation

@seaspotter

@seaspotter seaspotter commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

Hier gefunden: #4289 (comment)

Summary by Sourcery

Reset charge-point retry timing when charging is no longer active to prevent repeated retries across control cycles.

Bug Fixes:

  • Reset the charge-point retry timestamp when charging stops, preventing CP retries from firing repeatedly each cycle.

Enhancements:

  • Keep charge-start and retry timing state consistent when the requested current reaches zero.
  • Propagate changes to the CP retry timestamp through control-parameter topic processing.

Tests:

  • Add coverage for resetting retry timestamps when idle and preserving timing state while charging.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="packages/control/load_protocol.py" line_range="65" />
<code_context>
                 self.data.control_parameter.timestamp_charge_start = create_timestamp()
         elif self.data.set.current == 0:
             self.data.control_parameter.timestamp_charge_start = None
+            self.data.control_parameter.timestamp_last_cp_retry = None

     def is_charging_stop_allowed(self) -> bool:
</code_context>
<issue_to_address>
**Retries carry across charging sessions**

When current is zero, `timestamp_charge_start` is already `None`, and `timestamp_last_cp_retry` is still set before charging resumes, `set_timestamp_charge_start` skips the reset, so `initiate_control_pilot_interruption` uses the stale retry timestamp and retries before the configured interval has elapsed, causing an immediate control-pilot interruption.

Clear `timestamp_last_cp_retry` whenever current is zero, even when `timestamp_charge_start` is already `None`.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread packages/control/load_protocol.py Resolved
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.

1 participant