Skip to content

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.


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.

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.


Add the home battery as a dynamic load in Settings > Devices.

FieldValueNotes
NameHome BatteryDisplay name
TypeDynamicAdjustable charge rate
Switch entityswitch.battery_charger_enabledEnable/disable charging
Parameter entitynumber.battery_charge_rate_pctCharge rate as percentage
Parameter min10Minimum charge rate (%)
Parameter max100Maximum charge rate (%)
Parameter unit%Percentage
Watts per unit50Watts per percentage point
Rated power5000Maximum charge power at 100%
Minimum power500Draw at 10% charge rate
Feedback entitysensor.battery_socBattery state of charge

The real power of battery management in Hanergy comes from placing the same device at multiple priority positions.

FieldValueNotes
LoadHome Battery
Minimum surplus500Low threshold — start charging early
Threshold80Charge until SOC reaches 80%
EnabledYes

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.

FieldValueNotes
LoadHome BatterySame device
Minimum surplus2000Only charge further when surplus is abundant
Threshold100Charge to full
EnabledYes

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.


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.


  • 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.