Skip to content

Conversation

@Maschga
Copy link
Collaborator

@Maschga Maschga commented Jan 23, 2026

Fix #26811

TODO:

  • test

\cc @andig

@Maschga Maschga assigned Maschga and unassigned Maschga Jan 23, 2026
@Maschga Maschga added enhancement New feature or request devices Specific device support labels Jan 23, 2026
@Maschga Maschga marked this pull request as ready for review January 24, 2026 16:05
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • In the BatteryNormal case, dereferencing m.rSocStrategy assumes it was always captured earlier; consider guarding against a nil value (or enforcing the invariant more explicitly) to prevent a potential panic if this code path is reused or reordered in the future.
  • You clear m.rSocStrategy even when Write fails; consider only resetting it after a successful write so you don't lose the original strategy in error scenarios.
  • If RCT instances can be used from multiple goroutines, access to rSocStrategy should be synchronized (e.g., via a mutex) to avoid data races when capturing and restoring the SOC strategy.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In the `BatteryNormal` case, dereferencing `m.rSocStrategy` assumes it was always captured earlier; consider guarding against a nil value (or enforcing the invariant more explicitly) to prevent a potential panic if this code path is reused or reordered in the future.
- You clear `m.rSocStrategy` even when `Write` fails; consider only resetting it after a successful write so you don't lose the original strategy in error scenarios.
- If `RCT` instances can be used from multiple goroutines, access to `rSocStrategy` should be synchronized (e.g., via a mutex) to avoid data races when capturing and restoring the SOC strategy.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@andig andig merged commit 6183857 into evcc-io:master Jan 25, 2026
16 checks passed
@Maschga Maschga deleted the rct/reset-soc-strategy branch January 25, 2026 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devices Specific device support enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RCT Power SOC Zielauswahl

2 participants