SMA hybrid: add battery mode 4 (holdcharge)#31911
Conversation
Implementation of evcc-io#27906 for SMA hybrid inverter. Signed-off-by: Frank Behrens <frank@harz.behrens.de>
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The new
case: 4block 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
2424forCmpBMS.OpModis 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.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
Thanks for building and testing this! |
|
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? |
|
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. |
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: