Energy Sensors
Energy sensors are the foundation of Hanergy’s surplus calculation. They tell the engine how much power is being produced, consumed, and exchanged with the grid at any given moment.
Required Sensors
Section titled “Required Sensors”Hanergy needs the following Home Assistant sensor entities mapped in order to calculate surplus:
| Sensor | Unit | Required | Description |
|---|---|---|---|
| Grid Import | W | Yes | Power currently being drawn from the grid. Must be a non-negative value — the entity should read 0 when no import is occurring. |
| Grid Export | W | Yes | Power currently being sent back to the grid. Must be a non-negative value — the entity should read 0 when no export is occurring. |
| Production | W | Yes | Total solar (or wind) generation output. For most setups, this is the inverter output sensor. |
| Consumption | W | No | Total household power consumption. If omitted, Hanergy derives this value automatically (see below). |
Derived Consumption
Section titled “Derived Consumption”When the Consumption sensor is left empty, Hanergy calculates it automatically using the standard energy balance formula:
consumption = production + grid_import - grid_exportThis works correctly in the vast majority of residential setups. Only provide an explicit consumption sensor if your Home Assistant installation already exposes a dedicated whole-home energy monitor (such as a Shelly EM or Fronius Smart Meter on the main breaker) and you want to use it as the authoritative source.
Handling Signed Meters
Section titled “Handling Signed Meters”Some smart meters and inverters report grid power as a single signed value — positive for import, negative for export (or vice versa). Hanergy requires separate, non-negative entities for import and export.
If your meter works this way, create two template sensors in Home Assistant:
Multiple Sensors per Field
Section titled “Multiple Sensors per Field”If your system has multiple production sources (e.g., two inverters on different roof arrays), you can use a Home Assistant template sensor to sum them before mapping the result in Hanergy:
template: - sensor: - name: "Total Solar Production" unit_of_measurement: "W" state: > {{ (states('sensor.inverter_east') | float(0)) + (states('sensor.inverter_west') | float(0)) }}Map the combined sensor.total_solar_production entity in Hanergy’s Production field.