DIY Solar-Aware EV Charging with Home Assistant, Deye Inverter and a Standard 7 kW Wallbox

Kosmik

Honorary Master
Joined
Sep 21, 2007
Messages
31,519
Reaction score
12,026
Location
In the valley
*Disclosure AI helped me formulate the post as its a lot lol.

I wanted to share a project I've been developing to automate EV charging using Home Assistant, solar generation and home battery monitoring, without needing a dedicated solar-aware EV charger.
The setup uses a Deye hybrid inverter, an existing 7 kW AC wallbox and a Wi-Fi-controlled EVSE feeder.
The vehicle in my case is a Geely E2, but the approach should be applicable to many EVs and ordinary AC chargers that don't provide remote control or dynamic charging-current adjustment.

1. The setup​

  • 8 kW Deye hybrid inverter
  • Approximately 6.5 kW solar PV
  • 11 kWh home battery
  • Standard 7 kW single-phase AC EV wallbox
  • eWeLink 63 A Wi-Fi smart metering switch
  • Home Assistant running on a Raspberry Pi 3 B+
  • Solarman inverter integration
  • EV with manually adjustable AC charging current

2. Electrical installation and manual bypass​


1794835503913.png1794835602650.png

An important consideration was ensuring that the electrical installation would support the wallbox safely, independently of the Home Assistant automation.
The garage distribution board was upgraded to a larger enclosure, accommodating both the existing garage circuits and the additional EV charging equipment.
A new 6 mm² copper feeder was installed between the main household distribution board and the garage.
Although I currently expect to charge primarily between 8 A and 20 A, the 7 kW wallbox supports up to approximately 32 A.
The 6 mm² cable was selected to provide capacity for higher charging currents, subject to the cable installation conditions, protection arrangements and electrician's assessment.

The installation incorporates:
  • Dedicated protection at the main distribution board and garage distribution board
  • EV charging circuit protection and appropriate residual-current protection
  • eWeLink 63 A Wi-Fi metering switch for automated feeder control
  • 40 A two-pole AUTO/OFF/MANUAL changeover arrangement
  • External EV charger isolator
The EV charging circuit's residual-current protection was considered in conjunction with the wallbox manufacturer's requirements, including 30 mA Type A protection and 6 mA DC residual-current detection.

Why the manual bypass matters​

I specifically wanted to avoid a situation where a Home Assistant failure, Wi-Fi outage or smart-switch malfunction prevents the vehicle from charging.

The changeover provides three operating positions:
PositionBehaviour
AUTOEVSE receives power through the smart switch, under Home Assistant control
OFFEVSE supply is disconnected through the changeover
MANUALEVSE receives power through a hardwired bypass, independently of Home Assistant and the smart switch

In MANUAL mode, the wallbox operates as a normal standalone EV charger.
The manual bypass avoids the smart switching device but does not bypass the circuit breakers, residual-current protection or required safety isolation.
This separation between electrical protection, automated control and manual operation was a key design consideration.
The electrical work and equipment selection were handled by a qualified electrician.

3. The objective​

My inverter operates in zero-export mode. Once the household battery is sufficiently charged and household demand is satisfied, additional available solar generation can be curtailed.
Rather than waste that generation, I wanted to redirect it towards charging the EV.
However, I didn't want the EV to unnecessarily discharge the home battery or draw substantial power from the grid.
The solution is a Home Assistant controller that makes charging decisions based on solar generation, available headroom, household battery SOC and actual power flows.

4. How the controller works​

I created four operating modes:

ModeFunction
AutoEnables charging when solar and battery conditions permit
OffKeeps charging disabled
OnEnables charging regardless of solar availability
OverrideTemporarily enables charging for a defined period

These software modes are independent of the physical AUTO/OFF/MANUAL changeover switch.

Automatic charging currently uses these parameters:
  • Operating window: 08:00–17:00
  • Minimum home battery SOC for starting: 80%
  • Minimum solar production: 2,200 W
  • Minimum calculated solar headroom: 2,200 W
  • Solar-ready confirmation delay: 5 minutes
  • Sustained power-deficit delay: 10 minutes
The delays prevent the charger from switching on and off whenever a cloud passes over.
The controller evaluates several Home Assistant template sensors, including solar generation, battery charging/discharging, grid import/export and calculated available solar headroom.
It then enables or disables the EVSE feeder using the Wi-Fi switch.

5. Charging current​

The EV itself allows the AC charging current to be set manually.
I've tested charging at 12 A, approximately 2.8 kW at 230 V.
This works reasonably well as a compromise with the available solar generation, although it isn't true dynamic solar following.
A limitation of this approach is that Home Assistant cannot automatically reduce the EV's charging current when solar production drops. It can only enable or disable the charging supply.
The controller therefore relies on delayed power-deficit detection and minimum operating conditions rather than continuously matching available generation.

6. Reliability considerations​

One area I've paid particular attention to is avoiding inappropriate switching when inverter readings become unavailable or Home Assistant restarts.
The controller uses a monitoring-fault sensor and additional availability checks.
I've also tried to minimise unnecessary automation complexity, as this runs on a Raspberry Pi 3 B+ alongside the rest of my Home Assistant installation.
The implementation is still undergoing testing and refinement, particularly around sustained grid import, battery discharge and restart behaviour.
The physical manual bypass is an additional safeguard against losing charging functionality due to a control-system failure.

7. Current results​

The following have been tested successfully:
  • Automatic charging initiation under suitable solar conditions
  • Blocking automatic charging when insufficient solar is available
  • Manual charging mode
  • Charging at 12 A
  • Automatic shutdown at the end of the permitted charging window
  • Monitoring the inverter's response to EV charging demand
The system is not yet a replacement for a fully integrated solar-aware charger, but it provides much of the functionality I wanted without replacing the supplied wallbox.

8. Next steps and feedback​

I'm particularly interested in how others handle:
  • PV fluctuations and switching hysteresis
  • Battery discharge versus grid import as the primary stopping condition
  • Home Assistant restart and sensor-availability issues
  • Avoiding repeated power cycling of an ordinary EVSE
  • Potential improvements to calculated solar headroom when operating with zero export
I'm happy to share the genericised YAML templates, helpers and controller automation.
The design is intentionally fairly straightforward and should be adaptable to other hybrid inverters and EV charging setups.


1794836472053.png
 
Last edited:
Interesting, we will be looking at Deye's EV charger when we get an EV...

Not to knock the product, my one concern is how to have it charge outside of solar. I know deye inverter allows smart loads etc on its external port but it's still AC. That's also why it made more sense to me to have a seperate system that the solar can supply but it's not needing direct integration with the aux port.

Others have said, a DC option would be nice but I don't think inverters have rhe option. The only DC optio is to from batteries unless there is a way to tap into that but then how does the var handle it?

I don't think the vehicle caters for rapid changing in solar Flux, otherwise if it can, some form of circuit with a cut over may work but would be clunky.
 
I did something similar with my EV charging. I am busy expanding my house, and the garage where the charger will be installed is not built yet, so I am depending on the granny charger for now for top-ups, which is fine, since I do less than 20km a day at the moment.

I setup a Node Red flow which monitors solar excess, predicted cloud cover, home load and battery SOC, with a few others. I also have delayed-action rules to prevent the charging from starting and stopping unnecessarily. When it starts charging, there is a ramp-up check which runs for 2 minutes. If charging touches the battery or solar production does not ramp up to the minimum excess level, charging stops and waits 10 minutes. If the battery is below 85% but there is enough excess early in the day, it will allow charging. Above 85%, charging is allowed to drain the battery up to a certain max wattage. So once the battery has hit 85%, the car is not allowed to drain it below that.

Cloud cover is also monitored so that the ramp-up check does not drain the battery if HA reports clouds. If production suddenly drops, it might mean moving clouds, so the flow will stop charging and wait 20 minutes.

My EV, a BYD Dolphin Surf, doesn't have a Stop Charging option, so instead, I set the charging schedule to be between midnight and 00:02 to stop charging. If the charging checks pass, the charging schedule is disabled. Charging is only allowed at night (5pm to 8am) if the batteries are storing over 20kwh.

At the end of the day, very similar to your setup, I think.

Disclaimer: I used AI to consolidate all the flows and automations and allow rules to be setup in a single node in the flow. I'm a developer, but I don't mind if AI takes my job when it comes to maintaining code for my private hobbies.
 
Last edited:
Not to knock the product, my one concern is how to have it charge outside of solar. I know deye inverter allows smart loads etc on its external port but it's still AC. That's also why it made more sense to me to have a seperate system that the solar can supply but it's not needing direct integration with the aux port.

Others have said, a DC option would be nice but I don't think inverters have rhe option. The only DC optio is to from batteries unless there is a way to tap into that but then how does the var handle it?

I don't think the vehicle caters for rapid changing in solar Flux, otherwise if it can, some form of circuit with a cut over may work but would be clunky.

Time based/limited charging? I'll admit I haven't done much research in to the Deye EV charger but since we have a Deye inverter it makes sense to look at their charger.

As for DC chargers, they are horrendously expensive, my wife is looking at some for their factory but they are in the hundred's of thousands a charger.
 
Not to knock the product, my one concern is how to have it charge outside of solar. I know deye inverter allows smart loads etc on its external port but it's still AC. That's also why it made more sense to me to have a seperate system that the solar can supply but it's not needing direct integration with the aux port.

Others have said, a DC option would be nice but I don't think inverters have rhe option. The only DC optio is to from batteries unless there is a way to tap into that but then how does the var handle it?

I don't think the vehicle caters for rapid changing in solar Flux, otherwise if it can, some form of circuit with a cut over may work but would be clunky.
Standalone charge controllers are DC.
 
Time based/limited charging? I'll admit I haven't done much research in to the Deye EV charger but since we have a Deye inverter it makes sense to look at their charger.

As for DC chargers, they are horrendously expensive, my wife is looking at some for their factory but they are in the hundred's of thousands a charger.
Most EV's are offered lately with a "granny" and a wallbox. That's pretty much why I did this, my only cost was installation, not kit.
 
There are solutions but it looks hell expensive.


Sadly it'll probably stay that way for a while, there won't enough economy of scale to bring prices down. And there's a path dependency thing. If you already have panels on an inverter, it makes sense to use what you have.

But it would be cool to be able to treat an EV as a kind of hot-plugged auxiliary battery. This V2H stuff is interesting for those of us who don't already have full solar installs.
 
My setup is similar, but one additional thing I do is to check my left over battery capacity in the morning and check the forecast solar for the day. If I'm predicted to generate enough to fully charge the home battery, then I top up the EV until the battery is at minimum allowed SOC as set in the timers. This way I maximise how much solar I can harvest in the day while at work. I'm obviously fortunate that my system is big enough that I have left over battery capacity in the morning.
 
My setup is similar, but one additional thing I do is to check my left over battery capacity in the morning and check the forecast solar for the day. If I'm predicted to generate enough to fully charge the home battery, then I top up the EV until the battery is at minimum allowed SOC as set in the timers. This way I maximise how much solar I can harvest in the day while at work. I'm obviously fortunate that my system is big enough that I have left over battery capacity in the morning.
yeah mine is pretty much empty by morning, I've normally drawn about 0.8kwh to 1kwh by the time the sun takes over the house load and starts charging.

But as long as I can maximize my system I'm happy. I can't add more panels , only option would be a second or replacing panels as they are "old" 455w and I believe you get like 650w now but then there is the whole string argument and voltage so not sure.
 
Time based/limited charging? I'll admit I haven't done much research in to the Deye EV charger but since we have a Deye inverter it makes sense to look at their charger.

As for DC chargers, they are horrendously expensive, my wife is looking at some for their factory but they are in the hundred's of thousands a charger.
Oh, my aspire does not have time based charging. The apex does.

Its literally plug and charge as they say, so as soon as it detects a handshake , it charges. You can configure the AC charge limit though from 5A to 32A in 1A increments.
 
Oh, my aspire does not have time based charging. The apex does.

Its literally plug and charge as they say, so as soon as it detects a handshake , it charges. You can configure the AC charge limit though from 5A to 32A in 1A increments.
Yeah, I just have mine set to charge during solar hours, like between 10 and 16:00. And then I override it if I need the car the next day.
 
I have the Chery 7kW wall charger with Growatt Inverters. I used GPT to help setup automations to change the charge current based on home load and solar availability at the time. It measures every 5 minutes and then adjusts based on the power availability. It's been working quite well so far without me having to worry that the house batteries get drained to charge the car.
 
Top
Sign up to the MyBroadband newsletter
X