Skip to content

Conversation

@marcelGoerentz
Copy link
Contributor

@marcelGoerentz marcelGoerentz commented Nov 14, 2025

Fix #23509

Make maximum power consumption configurable for vehicles

@marcelGoerentz
Copy link
Contributor Author

@anndig this may fix the 1p/3p discussion

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.

@andig
Copy link
Member

andig commented Nov 14, 2025

For what purpose?

@marcelGoerentz
Copy link
Contributor Author

Planner will estimate correct time. For example my BMW iX3 can only charge with maximum 11kW. But with single phase it can be charged with 32A.
So the planner thinks it can charge also with 32A on all 3 phases. This setting will correct it to the correct value. So the planner knows the vehicle needs double the time.

@andig
Copy link
Member

andig commented Nov 14, 2025

It would be nice to have the discussion in #25079 and honor #25079 (comment) before we build partial solutions.

@marcelGoerentz
Copy link
Contributor Author

Ah yes I see.

@marcelGoerentz
Copy link
Contributor Author

We could merge both solutions couldn't we?

This solution is better for 1p/3p maximum current mismatch that some vehicles have.

@mfuchs1984
Copy link
Collaborator

Planner will estimate correct time.

Based on how I understand the impact of the proposed changes:

Is it really necessary to include the calculation of the current based on maximum vehicle power into setLimit for that purpose? Wouldn't it be enough to change effectiveMaxPower?

Look at e.g. #25239, the car has a limit of 7.4 kW, regardless of 3 or 1 phase(s). This results in a 3 phase current of 10.72 A. When using a charger without mA-controll, this results in 10 A. To actually achieve the 7.4 kW, the vehicle even needs at least 12 A signalled current.

Even usual 11 kW vehicles typically charge with about 10.4 to 10.6 kW on an 11 kW charger, without mA control, this seems to limit the sognalled charge current to 15 A, this charging with an even lower speed.

@marcelGoerentz
Copy link
Contributor Author

That's correct, changing effectiveMaxPower would be sufficient. The other changes are just for not seeing the gap between the offered current and the consumed current in the UI.

Regarding the consumed current you are right that there are losses, but we should offer the correct current anyway -> so for 11kW 16A at 3p and for 7,3kW 32A at 1p or 11A at 3p ( I know it would be 7,5kW). This way we can make sure that always enough current will be provided. We can leave the efficiency at 0,9 and this will make sure that the planner will start slightly before the "perfect" start time. Trying to estimate the correct efficiency will never work.

Copy link

@cubic-dev-ai cubic-dev-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.

3 issues found across 8 files

Prompt for AI agents (all 3 issues)

Understand the root cause of the following 3 issues and fix them.


<file name="i18n/de.json">

<violation number="1" location="i18n/de.json:579">
Fix the typo in the German help text so &quot;Fahrzeug&quot; is spelled correctly and the UI copy is accurate.</violation>
</file>

<file name="core/loadpoint_effective.go">

<violation number="1" location="core/loadpoint_effective.go:178">
`maxCurrent` is no longer limited when the vehicle reports only a max current or only a max power value, allowing the charger to exceed the vehicle spec.</violation>

<violation number="2" location="core/loadpoint_effective.go:243">
`lp.vehicle` is dereferenced without a nil check, causing a panic whenever the loadpoint has no active vehicle.</violation>
</file>

Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Ask questions if you need clarification on any suggestion

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

@github-actions github-actions bot removed the stale Outdated and ready to close label Nov 24, 2025
@andig andig marked this pull request as draft November 24, 2025 15:49
@marcelGoerentz
Copy link
Contributor Author

@cubic-dev-ai review this PR

@cubic-dev-ai
Copy link

cubic-dev-ai bot commented Nov 25, 2025

@cubic-dev-ai review this PR

@marcelGoerentz I've started the AI code review. It'll take a few minutes to complete.

Copy link

@cubic-dev-ai cubic-dev-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.

1 issue found across 8 files

Prompt for AI agents (all 1 issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="core/loadpoint_effective.go">

<violation number="1" location="core/loadpoint_effective.go:235">
Calling lp.vehicle.OnIdentified() before verifying lp.vehicle is non-nil will panic when no vehicle is attached. Check for lp.vehicle == nil before dereferencing.</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

@marcelGoerentz marcelGoerentz force-pushed the feature/add_max_power branch 2 times, most recently from b9f5917 to 54ad821 Compare December 1, 2025 14:15
@andig andig added enhancement New feature or request vehicles Specific vehicle support labels Dec 1, 2025
@mfuchs1984
Copy link
Collaborator

I think it's a good solution for the 1p 3p charge current problem. More elegant than the often requested different maxCurrent settings for 1p and 3p, while at the same time, it also improves the accuracy of the planner.

@marcelGoerentz
Copy link
Contributor Author

This is an improvement to the planner, as it now respects the vehicles charging power limit. It simplifies the handling for 1-phase and 3-phase charging, since the user doesn't need to manually switch the loadpoint configuration.

@andig
Copy link
Member

andig commented Dec 7, 2025

It simplifies the handling for 1-phase and 3-phase charging, since the user doesn't need to manually switch the loadpoint configuration.

Could you clarify?

Would someone line to propose a description and help text for such a parameter if it were added?

/cc @premultiply wdyt?

@premultiply
Copy link
Member

I think that sounds like a viable option, at least.

@marcelGoerentz
Copy link
Contributor Author

Could you clarify?

Sure. Currently, you need to adjust the loadpoint's max current for the Planner to plan correctly when the maximum current differs between 1‑phase (32A) and 3‑phase (16A).
Otherwise, the Planner assumes 32A.
With this enhancement, the Planner will respect the vehicle's maximum charging power and generate a correct plan.

@andig
Copy link
Member

andig commented Dec 7, 2025

I don‘t understand. It will dtill switch to fast charging and try to set 3p@32A, so you MUST limit to 16A. Doesn‘t this create more confusion?

@mfuchs1984
Copy link
Collaborator

There are a couple of vehicles that allow 1 phase charging with up to 32 A (e.g. our BMW i4), but only 16 A on 3 phases. This is great since it closes that gap between 3.6 and 4.1 kw. With the current maxCurrent settings, you have to decide to either not use more than 16 A on one phase or inaccurate planning. With maxPower, evcc will know that there is a limit on 3 phases but is still able to use the full range for 1 phase.

@mfuchs1984
Copy link
Collaborator

The other thing it resolves is planning for vehicles that charge with significantly lower power that offered.

E.g. #25239, the car has a limit of 7.4 kW, regardless of 3 or 1 phase(s). This results in a 3 phase current of 10.72 A. When using a charger without mA-control, this results in 10 A. To actually achieve the 7.4 kW, the vehicle needs at least 12 A signalled current. With maxPower, you can signal those 12 A or more while the planner calculates with the correct 7.4 kW.

The only way to do this currently is to increase the configured capacity, but people don't understand this, so there are quite some issues and discussions here asking on how to deal with this issues. I think allowing to configure the charge power is easier to understand.

@marcelGoerentz
Copy link
Contributor Author

@mfuchs1984 Yeah, you are right.

@andig
Copy link
Member

andig commented Dec 7, 2025

There are a couple of vehicles that allow 1 phase charging with up to 32 A (e.g. our BMW i4), but only 16 A on 3 phases.

...so you'd statically configure 32A in this case?

With maxPower, evcc will know that there is a limit on 3 phases but is still able to use the full range for 1 phase.

It would still only do this for the planner when estimating. It would still switch to 32A. Imho this is prone to a lot of confusion!

This (amongst others) is why I've asked:

Would someone line to propose a description and help text for such a parameter if it were added?

I still don't see if this really is a vehicle setting or a planner hint or a no-go.

@mfuchs1984
Copy link
Collaborator

It would still only do this for the planner when estimating.

Me too, I think this is how it implemented @marcelGoerentz

@marcelGoerentz
Copy link
Contributor Author

Correct, it is only for the Planner when estimating.
I could make it interfere with the offered current, but I don't think this is necessary since the vehicles only consume as much power as they want (as far as I know this is a normal behavior of any car).
Nevertheless, when a car can charge with 32A on one phase and only with the 16A on all 3 phases, isn't the max current still 32A?
So the configuration for a car is still the same.
I would see the max power option at the vehicle, otherwise you need to remember for every car how much power it can consume and you need to set every time in the planner when changing the vehicle. I mean unless you save it in another way.

@andig
Copy link
Member

andig commented Dec 7, 2025

Would someone like to propose a description and help text for such a parameter if it were added?

@mfuchs1984
Copy link
Collaborator

@marcelGoerentz I think you should change the title of the PR. It's misleading since and apply limits when charging is not true any more.

@marcelGoerentz marcelGoerentz changed the title Add maximum power config to vehicle and apply limits when charging Add maximum power config to vehicle Dec 7, 2025
Signed-off-by: Marcel Goerentz <[email protected]>
Signed-off-by: Marcel Goerentz <[email protected]>
Signed-off-by: Marcel Goerentz <[email protected]>
Signed-off-by: Marcel Goerentz <[email protected]>
Signed-off-by: Marcel Goerentz <[email protected]>
@marcelGoerentz marcelGoerentz marked this pull request as ready for review December 8, 2025 11:25
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 - here's some feedback:

  • The new maxPower parameter is declared as name: maxpower in defaults.yaml but referenced as maxPower elsewhere (templates, presets, Go structs), which is likely to break binding; align the naming consistently (including case) across all usages.
  • Consider adding maxPower to the initialValues object in VehicleModal.vue so that the form has a defined default and behaves consistently with the other configurable vehicle fields.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new `maxPower` parameter is declared as `name: maxpower` in `defaults.yaml` but referenced as `maxPower` elsewhere (templates, presets, Go structs), which is likely to break binding; align the naming consistently (including case) across all usages.
- Consider adding `maxPower` to the `initialValues` object in `VehicleModal.vue` so that the form has a defined default and behaves consistently with the other configurable vehicle fields.

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
Copy link
Member

andig commented Dec 8, 2025

@naltatis could you check regarding UI? I'm surprised these fields actually need hard-coding?

Signed-off-by: Marcel Goerentz <[email protected]>
@andig andig added the ux User experience/ interface label Dec 9, 2025
@andig
Copy link
Member

andig commented Dec 9, 2025

@naltatis please check ui part/ tempalte. LGTM.

@andig andig changed the title Add maximum power config to vehicle Vehicles: add maximum power planner hint Dec 9, 2025
Added missing periods to the help descriptions for maximum vehicle charging power.
@andig
Copy link
Member

andig commented Dec 13, 2025

@naltatis ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request ux User experience/ interface vehicles Specific vehicle support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MELCloud integration (Mitsubishi Electric heat pumps)

5 participants