Hanergy
Back to Blog

How to Charge Your EV with Solar Surplus in Home Assistant

H
Hanergy Team
ev-charging solar home-assistant tutorial

How to Charge Your EV with Solar Surplus in Home Assistant

Most EV owners charge overnight from the grid. It works, but it means paying retail electricity rates for every kilowatt-hour pushed into the battery. Meanwhile, during the day, solar panels on the roof produce surplus energy that gets exported back to the grid — often at a fraction of the purchase price.

Hanergy changes this equation by automatically routing solar surplus to the EV charger in real time.

The Problem with Manual Solar Charging

Manually timing EV charging to coincide with solar production is impractical. Cloud cover changes minute to minute. Production peaks shift with the seasons. And nobody wants to spend their day watching a solar production graph and adjusting charger settings.

Some Home Assistant users build automations to handle this, but maintaining threshold-based automations with proper hysteresis, anti-cycling logic, and dynamic setpoint adjustment is surprisingly complex. A single automation quickly becomes a fragile chain of helpers, templates, and edge cases.

How Hanergy Solves It

Hanergy runs as a Home Assistant add-on and evaluates solar surplus every 10 seconds. When surplus is available, Hanergy calculates the optimal charge rate for the EV charger and adjusts the setpoint automatically.

The key features for EV charging:

  • Dynamic charge rate adjustment. The charge current ramps up and down to match available surplus, maximizing solar self-consumption without grid import.
  • EMA smoothing. An exponential moving average filters out brief cloud transients, preventing the charger from oscillating between on and off every few seconds.
  • Anti-cycling protection. Configurable minimum on-time prevents the charger from cycling rapidly, which is hard on both the charger electronics and the vehicle’s onboard charger.
  • Priority cascade. If the EV charger sits at priority 1, it gets surplus before any other load. If surplus remains after the car is charging, Hanergy allocates it to the next load in the list.

Setting Up EV Solar Charging

Setting up takes under 10 minutes:

  1. Install Hanergy from the Home Assistant Add-on Store or via Docker.
  2. Map your energy sensors — solar production, grid import, grid export. The setup wizard walks through this.
  3. Add the EV charger as a dynamic load. Point Hanergy to the entity that controls charge current (e.g., number.wallbox_charging_current).
  4. Set the minimum power threshold. Most chargers require at least 6A (approximately 1,400W on single-phase). Hanergy will not activate charging below this level.
  5. Assign a priority. Place the charger at priority 1 if it should get surplus first.

That is the entire configuration. Hanergy handles the rest: surplus calculation, setpoint adjustment, hysteresis, and logging.

What to Expect

On a typical sunny day with a 6-10 kWp solar installation, Hanergy can deliver 20-40 kWh to an EV — enough for 100-200 km of range — entirely from solar surplus. On partly cloudy days, the charge rate dynamically adjusts, and the anti-cycling logic prevents unnecessary switching.

Every decision Hanergy makes is logged with a reason in the dashboard timeline, making it straightforward to understand exactly what happened and why.

Compatible Chargers

Hanergy works with any EV charger that has a Home Assistant integration exposing a controllable entity. Popular options include OpenEVSE, Wallbox, go-e Charger, Easee, Zaptec, and any OCPP-compatible charger.

Next Steps