Skip to content

SMA hybrid: add battery mode 4 (holdcharge)#31911

Merged
andig merged 1 commit into
evcc-io:masterfrom
frbehrens:feat/SMA-hybrid
Jul 18, 2026
Merged

SMA hybrid: add battery mode 4 (holdcharge)#31911
andig merged 1 commit into
evcc-io:masterfrom
frbehrens:feat/SMA-hybrid

Conversation

@frbehrens

Copy link
Copy Markdown
Contributor

Implementation of #27906 for SMA hybrid inverter.

Tests:
I run this successfully. I use a custom external rule (OpenHAB/mqtt), that did set the batterymode to holdcharge until noon, where the feed-in price turned negative. The loading of battery was delayed as expected:
grafik

Implementation of evcc-io#27906 for SMA hybrid inverter.

Signed-off-by: Frank Behrens <frank@harz.behrens.de>
@andig andig added the devices Specific device support label Jul 18, 2026
@github-actions github-actions Bot added the enhancement New feature or request label Jul 18, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

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:

  • The new case: 4 block largely duplicates the structure of the other modes; consider factoring the common Modbus write sequence (with parameters for the few differing values) into a reusable template/helper to reduce repetition and potential drift between modes.
  • The constant 2424 for CmpBMS.OpMod is a bit opaque; adding a named template variable or comment explaining what this mode value represents would make the configuration more maintainable and less error-prone for future changes.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new `case: 4` block largely duplicates the structure of the other modes; consider factoring the common Modbus write sequence (with parameters for the few differing values) into a reusable template/helper to reduce repetition and potential drift between modes.
- The constant `2424` for `CmpBMS.OpMod` is a bit opaque; adding a named template variable or comment explaining what this mode value represents would make the configuration more maintainable and less error-prone for future changes.

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 commented Jul 18, 2026

Copy link
Copy Markdown
Member

Thanks for building and testing this!

@andig
andig enabled auto-merge (squash) July 18, 2026 15:57
@andig
andig merged commit a3f5827 into evcc-io:master Jul 18, 2026
12 checks passed
@frbehrens
frbehrens deleted the feat/SMA-hybrid branch July 18, 2026 16:06
@MartinNumber1

Copy link
Copy Markdown

Hey, tolle Arbeit! ...Vorsichtig und höflich gefragt: Wäre es auch noch möglich Mode 4 für die SMA-Batteriewechselrichter (Sunny Boy Storage 3.7 - Modbus) zu adaptieren?

@andig

andig commented Jul 22, 2026

Copy link
Copy Markdown
Member

Ist denn klar, welche Register dort zu verwenden sind?

@MartinNumber1

Copy link
Copy Markdown

Ist denn klar, welche Register dort zu verwenden sind?

Leider nein. 😏 Unwissenheit und Zeitmangel lassen es bei mir auch nicht zu dieses herauszufinden.. Grundsätzlich stehen die Register-Listen ja frei verfügbar auf der SMA-Homepage. Wobei es softwarebedingte Unterschiede gibt bei den Geräten, also gibt getrennte Versionen nach < BJ 2018 und > BJ 2018.
Hatte gehofft, dass vielleicht noch mehr Leute hier "Bedarf anmelden" und jemand es umzusetzen weiß, kann und möchte... 🙂

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.

3 participants