EVSE integration

By far the most complex automation I have running is for my EVSE (EV charger) control. Combining the solar inverter integration (SMA), the EVSE integration (Wallbox), EV integrations (Polestar, Fiat, MG4) and a few other bits and pieces to provide:

  • Scheduled charge
  • State of Charge limit
  • Excess solar power absorption
  • Over-voltage protection
  • Under-voltage protection

I will first describe the what for these functions, I will add the how and details later:

Scheduled charge
Both the Polestar and the Wallbox allow to set a scheduled charge. But of course it is more convenient to be able to set the schedule from within HA. I only use it in combination with the other functionality to make sure a car is charged the next day if needed.

State of Charge limit
Polestar recommends not to charge to 100% SoC to extend the battery life. Unfortunately the limit can only be set in the car, not from the app. This function allows me to set the limit from HA. I usually have it set at 80%, unless I really need the extra range.

Excess solar power absorption
Often exporting excess power is not attractive, a home battery can help to limit your export, an EV has a nice big battery to use for excess solar absorption as well. I’m lucky enough to be on net metering, so I don’t really have a benefit from this, but I’m future proof.

Over-voltage protection
When there is too much solar power generation the power network cannot cope and inverters start shutting down. Many people will not even realize, but it is a lost opportunity of course. In my neighborhood this is a serious issue, many large new installations on a dated network. On a sunny day I can avoid a dozen shutdown events as long as there is a car ready to charge.

Under-voltage protection
As much a dated power network causes over-voltage shutdowns it can also lead to severe under-voltage. With the many new solar installations also came many new EVs to the neighborhood. When the sun is down and people start charging their cars the mains voltage collapses. To at least not make it worse this function can limit the EV charging power.

The five functions work in concert. They can be enabled and have their parameters set from the management dashboard. But for day-to-day use this is too complicated. So I came up with three charging modes; ‘Whenever’, ‘Tomorrow’ and ‘Now’.

In ‘Whenever’ mode the excess solar absorption, the over- and under-voltage protection, and the SoC limit functions are active (if enabled), but the car is only charged as needed for that functionality.

In ‘Tomorrow’ mode the schedule function also becomes active to assure the car will be charged to the SoC limit in the morning.

In ‘Now’ mode the car will charge at the maximum charge current to charge asap to the SoC limit.

The automation runs every 12 seconds, checks if indeed the charger is happily communicating with a car and then evaluates all functions in order of priority to set the charger pause/resume and the charger current limit.

OVERVOLTAGE PROTECTION

The overvoltage protection helps to prevent the solar inverter from shutting down when the grid gets overloaded on a sunny day. According to the rules here, the inverter must shut down when the 10 min. average of the mains voltage (measured at the inverter) reaches 253 Volt RMS. Charging a car (pushing less onto or even drawing current from the net) affects the voltage delta between the street and the inverter. It is matter of keeping the inverter voltage below the 253V threshold until the neighbor’s solar systems start shutting down. It is like running from a bear, you only need to be faster than your friend.

The overvoltage protection automation has two stages, a passive protection and an active protection. When the connected vehicle is not charging, the initiation of a charge is too slow to correct. So the passive overvoltage protection kicks in at 250V at 6A and stops again at 245V (on/off controller with 5V hysteresis). The active overvoltage protection kicks in at 252V, stepping up the charge current with 1A every 12s loop as long as the voltage is higher than 252 V, keeping the charge current where it is when the voltage is between 252V and 250V, and stepping the charge current down when the voltage is below 250V (integrating controller with 2V hysteresis). The controllers use the 10 min average voltage at the solar inverter. The thresholds and set values can be changed from my management dashboard.

UNDERVOLTAGE PROTECTION

Undervoltage is a real issue in my neighborhood. When the sun goes down, people return home from work and start charging EVs and cooking, it can get real bad.

The undervoltage protection function monitors the mains voltage. If the voltage drops below 195V rms is starts limiting the charge current, similar to the overvoltage protection it step down 1A every 12s loop as long as the voltage is below 195V. When the voltage reaches 200V it start stepping the current up again (integrating controller with 5V hysteresis). Here too the thresholds can be changed from the management dashboard.
Screenshot 2024-02-25 193522

The undervoltage protection at work:

TO BE CONTINUED

3 Likes

I have updated the original post with a description of how the overvoltage protection function works.

1 Like

I have added the description of the undervoltage protection function.

1 Like

Hi, I just stumbled on this topic that addresses the same questions I try to solve besides the undervoltage

Do you mind sharing your scripts / logic behind the use cases?

So far I only handle the excess solar case, but i need more intelligence in there to prioritize where the excess goes to and like the idea of targeting before the day for a certain charging strategy

Full logic for my EVSE / Solar integration:









Latest dashboard:


Thank you, excellent work!

What is the magic in the overvoltage protection how do you prevent it?

I have it sometimes when I have over 11kwh energy coming in and it cuts for too long to be efficient

My logic will be around

  1. charging home battery (9.2kwh) but this should be doubled to become really autonomous and handle the power of the heatpump( max 11kw
  2. 2 32 kWh car chargers for hybrid cars,
  3. (over)heating my hot water boiler,
  4. (over)heating or cooling my cv boiler

Priorities in there
0. Reduce/optimize energy that is optional / not needed depending on moments of the day

  1. charge for home to get max self sufficiency
    2 charge orthers (cars, boilers,…) without/limited using home batteries (excess solar power and cheap grid energy)
    2.1 car of wife who gets reimbursed by company
    2.2 water boiler
    2.3 cv boiler

Target

  • solar use 99%
  • Grid usage only during 20% of day at cheapest moments/free

Elements I am planning to use

  • excess solar energy (w)
  • state of charge battery, car,….
  • forecast solar energy
  • forecast grid prices
  • eco modes of the house

What do you think about my dream and what do you think should be included

The overvoltage protection is to avoid my solar system from shutting down. Many systems have been added in the street recently, the network cannot cope with generated current, thus the mains voltage is driven up. The solar systems must shut down when the 10 min average voltage reaches 253 Volt.

When the mains voltage (10 min average) reaches 250 Volt, my car will start charging at 6A (provided one of the cars is connected and not at 100% SoC). This enables a quick reaction if the voltage rises further. When the mains voltage reaches 252 Volt the charge current will increase with 1 A every 12 seconds until the voltage drops below 252 Volts again. Under 250 Volt it decreases with 1 A every 12 seconds, thus keeping the voltage between those limits. When the voltage drops below 248 volt the charging stops.

This drops the voltage seen by the solar inverter enough to make sure the neighbor’s solar systems shutdown before mine. On a sunny day this logic easily prevents 10 to 20 shutdowns a day.

I estimate this prevents about 150 euro/year in lost generation due to shutdowns.