Battery Charging from Surplus¶
Charge a home battery from solar surplus using SOC-based multi-level priorities, ensuring the battery fills from free energy and never from the grid.
The Problem¶
Home batteries can charge from the grid if not managed properly, increasing electricity costs. Ideally, the battery should charge only when solar production exceeds household consumption, and should yield priority to more time-sensitive loads like an EV that needs to be ready for a commute.
The Solution¶
Hanergy configures the battery as a dynamic load with the charge rate as the adjustable parameter. By placing the same battery at multiple priority positions with different SOC thresholds, Hanergy implements a tiered charging strategy: charge to 80% at high priority, then top up to 100% only when surplus is abundant.
Device Configuration¶
Add the home battery as a dynamic load in Settings > Devices.
| Field | Value | Notes |
|---|---|---|
| Name | Home Battery | Display name |
| Type | Dynamic | Adjustable charge rate |
| Switch entity | switch.battery_charger_enabled | Enable/disable charging |
| Parameter entity | number.battery_charge_rate_pct | Charge rate as percentage |
| Parameter min | 10 | Minimum charge rate (%) |
| Parameter max | 100 | Maximum charge rate (%) |
| Parameter unit | % | Percentage |
| Watts per unit | 50 | Watts per percentage point |
| Rated power | 5000 | Maximum charge power at 100% |
| Minimum power | 500 | Draw at 10% charge rate |
| Feedback entity | sensor.battery_soc | Battery state of charge |
Charge rate vs amps
Some battery inverters expose charge rate as a percentage of maximum current, others as amps. Use whichever entity your HA integration provides as the parameter entity, and adjust watts_per_unit accordingly.
SOC-Based Multi-Level Priorities¶
The real power of battery management in Hanergy comes from placing the same device at multiple priority positions.
Priority 1: Charge to 80% (high priority)¶
| Field | Value | Notes |
|---|---|---|
| Load | Home Battery | |
| Minimum surplus | 500 | Low threshold -- start charging early |
| Threshold | 80 | Charge until SOC reaches 80% |
| Enabled | Yes |
This entry sits near the top of the priority list. With a low surplus requirement of 500 W, the battery begins absorbing surplus as soon as it is available. The engine considers this entry satisfied when the battery SOC sensor reads 80% or higher.
Priority 5: Charge 80-100% (low priority)¶
| Field | Value | Notes |
|---|---|---|
| Load | Home Battery | Same device |
| Minimum surplus | 2000 | Only charge further when surplus is abundant |
| Threshold | 100 | Charge to full |
| Enabled | Yes |
This entry sits lower in the priority list. It only activates after higher-priority loads (EV, heat pump) are satisfied or running, and only when at least 2000 W of surplus remains. This ensures the battery reaches 100% only on high-production days, while the 80% baseline is reached on most days.
Grid Protection¶
To ensure the battery never charges from the grid, verify these engine settings:
- Grid import limit (
grid_import_limit_w): set to a value like 50 W. If grid import exceeds this threshold, Hanergy sheds loads immediately, including battery charging. - Surplus buffer (
surplus_buffer_w): set to at least 100 W. This prevents Hanergy from allocating surplus right to the edge, which could cause brief grid import spikes.
With both settings configured, the battery only receives power when genuine surplus exists.
Tips¶
-
Feedback entity is essential. Without a SOC sensor as the feedback entity, Hanergy cannot determine when the battery has reached its target charge level. The priority entry would never be marked as satisfied and would consume surplus indefinitely.
-
Coordinate with the inverter's own logic. Some battery inverters have built-in solar charging logic. If both Hanergy and the inverter try to manage charge rate simultaneously, they may conflict. Disable the inverter's self-consumption mode and let Hanergy take full control via the charge rate entity.
-
Winter strategy. In low-production months, consider disabling the low-priority (80-100%) entry entirely. This frees up any remaining surplus for other loads rather than trying to top up the last 20% of battery capacity.