Skip to content

Conversation

mfuchs1984
Copy link
Collaborator

@mfuchs1984 mfuchs1984 commented Oct 12, 2025

Based on #23919, this adds phase switching to the existing Bender template. Replaces #24170.

Bender based chargers currently don't allow phase switching through Modbus, but since firmware version 5.33, through semp.

How it works:

  • When using SEMP, a recommended power consumption is sent to the charger. In case it is withing the 1p range, the charger switches to 1p, in case it is in the 3p range, to 3p.
  • The Bender controller is quite picky when it comes to the powers:
    • It always reports 1380 to 11040 as min and max over SEMP
    • but, to trigger phase switching, the recommended power consumption sent through SEMP has to be within the actual power range respecting the actual measured voltage. When sending e.g. 1380 (230 V * 6 A), it won't switch phases when the voltage is 231 V, when sending something higher that the maximum with current voltage and 16 A, it also won't switch. Since the grid voltage is 230V +- 10%, depending on the voltage, the power range for 1p can be within 207 V * 6 A = 1242 W to 253 V * 16 A = 4048 W and for 3p 207 V * 6 A * 3 = 3726 to 253 V * 16 A * 3 = 12144.
      • I chose 1518 W (253 V * 6 A) for 1p, since it it can be reached with both, 207 V and 253 V in case of 1p and never with 3p
      • I chose 9936 W (207 V *16 A * 3) for 3p, since it it can be reached with both, 207 V and 253 V in case of 3p and never with 1p
      • When testing with those values, I had a 100% success rate with voltages between about 225 V and 240 V.
    • and at the same time, when sending e.g. 11040 W (230*3*16) and a voltage higher than 230 V, it won't reach 16 A, just 15 (coarse current). But when it comes to maximum current, it is super simple: we can just send something very high. I chose 0xffff, so it will always allow control through modbus throughout the full 6 - 16 A range. Note that this will not trigger switching from 1p to 3p, since it is guaranteed to be outside of the real 3p power range. This is done through the heartbeat, which also ensures no SEMP timeout will occur on the charger side.
  • SEMP itself does not allow to get the phases, but it is possible through Modbus register 140.

When SEMP is activated on the charger, it will auto detect and check for phase switching support (which has to be enabled separately). When no phase switching is enabled, the user is informed through a warning. Otherwise, it logs support as info and decorates api.PhaseSwitcher and api.PhaseGetter.
Already existing logic for phase switching through Modbus on the new Mennekes chargers remains untouched. Also, whrn SEMP is not enabled, it will behave exactly as before, so this is an optional feature.

Compared to the new SEMP charger introduced with #23919, it offers more accurate measurements, proven stable Modbus control, RFID (including vehicle MAC, which is an awesome Bender feature) and a proper PhaseGetter.

@premultiply in case people report issues with phase switching with your new SEMP charger, it might also be related to selecting the correct powers, so you might try to use what I used here for 1p and 3p in this case.

I tested this for over a week now without issues on my Spelsberg Smart Pro. Would love to see it in the nightly to collect more data from other Bender users.

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.

Sorry @mfuchs1984, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@mfuchs1984
Copy link
Collaborator Author

Thanks for the feedback, will probably work on this again on Friday.

@andig andig marked this pull request as draft October 16, 2025 09:13
@mfuchs1984 mfuchs1984 marked this pull request as ready for review October 16, 2025 18:27
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 there - I've reviewed your changes and they look great!


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.

mfuchs1984 and others added 7 commits October 18, 2025 21:23
Co-authored-by: andig <cpuidle@gmail.com>
Co-authored-by: andig <cpuidle@gmail.com>
Co-authored-by: andig <cpuidle@gmail.com>
@mfuchs1984 mfuchs1984 requested a review from andig October 20, 2025 17:58
@mfuchs1984
Copy link
Collaborator Author

I updated it by

  • applying your suggestions
  • moving all logging to DEBUG (I think having the logs will help a lot during the first testing phase)
  • making clear that the old phase switching functions are specific for Mennekes

@mfuchs1984 mfuchs1984 marked this pull request as draft October 22, 2025 10:00
@mfuchs1984
Copy link
Collaborator Author

Will do some more testing after the latest changes.

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.

3 participants