evcc icon indicating copy to clipboard operation
evcc copied to clipboard

FR: Battery grid charging based on SoC

Open SolarPower2024 opened this issue 2 months ago • 6 comments

There are countries, where you are getting (differently) charged based on the maximum grid import power. (or highest average 15min energy consumption) and it makes sense to use the battery to compensate for those peaks. And for this, it's required to have a grid charging option for the battery in case it's not sufficient for the night. Especially in winter for heating, etc. It's currently working for a dynamic tarif, but not for a fixed one.

Describe the solution you'd like Next to the dynamic price grid charging also to have an option to start and end grid charging based on battery SoC (we would need to define a start SoC and a end SoC for grid charging)

Describe alternatives you've considered Manipulation of tarif prices to enable grid charging or overwriting evcc via external logic (e.g. HA) - both not practicable.

Additional context Even though it's not economical logical as first thought, grid charging with fixed tarif including the losses, it's making sense in the end to avoid additional grid charging costs.

SolarPower2024 avatar Oct 04 '26 11:10 SolarPower2024

Thanks for the request. This is a feature request, not a defect.

Grid charging of the home battery is currently price-driven only. batteryGridChargeActive in core/site_battery.go compares the current rate against batteryGridChargeLimit, and the rates it uses come from a dynamic tariff (a static price tariff is skipped, see the TariffTypePriceStatic check in the same file). The optimizer path (applyBatteryGridChargeLimit in core/site_optimizer.go) is also price-based. So a SoC-based start/stop band (hysteresis) for grid charging does not exist and would be a new battery control mode, which likely needs design discussion (interaction with the optimizer, planner and the existing price limit).

No further information needed for now. I did not find an earlier request for the same thing.

🤖 Generated with Claude Code

github-actions[bot] avatar Oct 04 '26 11:10 github-actions[bot]

Next to the dynamic price grid charging also to have an option to start and end grid charging based on battery SoC (we would need to define a start SoC and a end SoC for grid charging)

I'm not sure how that would help. Did you already look at https://github.com/evcc-io/evcc/pull/32881 which would manage grid charging for you?

andig avatar Oct 04 '26 11:10 andig

No, I did not try automatic mode yet. If you are saying this should be able to model that there, I will test it.

I'm not quite sure how the optimizer would trigger or suggest grid charging—it's still trying to keep costs as low as possible, right? So as the Optimizer doesn't know about the peak charges, it only sees a fixed tarif and will state (correctly) that with 10-20% charging/discharging losses it doesn't make sense to start grid charging - or am I wrong here?

SolarPower2024 avatar Oct 04 '26 11:10 SolarPower2024

So as the Optimizer doesn't know about the peak charges, it only sees a fixed tarif and will state (correctly) that with 10-20% charging/discharging losses it doesn't make sense to start grid charging - or am I wrong here?

Thats true but you have the same issue here: what would trigger the grid charging? If you want to do this purely on soc you can already do so via external automation. Doesn't have to be in evcc.

For the optimizer you could select peak shaping and it would try to keep import and/or export as low as possible which is exactly your case.

andig avatar Oct 04 '26 11:10 andig

Correct, as stated in initial post, outside of evcc of course I can trigger it.

If that's not wanted within, also ok. Just thought it would be a great feature for evcc, as it's widely used across different countries.

I'm setting up a system for somebody else, and this person cannot have change/configure/control in different systems. I want him to have only evcc as instance. And this is for sure also interesting for other people (I know not for Germany, as it's not a topic there 😅)

I will try the optimizer when it's implemented. I'm a bit hesitating as the quality of the outcome depends how good it's forecasting the demand. But perhaps that concern will go away when I'm seeing that it's working. Time will tell.

SolarPower2024 avatar Oct 04 '26 12:10 SolarPower2024

Worth noting you can already try it today!

andig avatar Oct 04 '26 12:10 andig