The 2025.12 Update adds support for Energy and Power Measurement in the Energy Dashboard. For Battery and Grid Homeassistant wants one sensor which provides positive values for consumption and negative values for export.
My e3dc solar inverter provides multiple values for grid power (Home to Grid, Grid to Home, Battery charged from grid) and battery power (Battery Charge, Battery Discharge). All of this valies are positive.
To work around this i found a solution which i wanted to share with you.
Since the UI only allows to setup “sum” for calculated sensors i created the following yaml based sensor configuration.
Power from Grid is calculated by:
<consumption from grid> + <battery charged from grid> - <export to grid>
Battery Power is calculated by:
<Battery Discharge> - <Battey Charge>
By mixing addition and substraction i create the positive/negative values which are neccessary for the HA Energy Dashboard Powergraphs
template:
- sensor:
- name: "Netzbezug"
default_entity_id: sensor.gridconsumption_calculated
unit_of_measurement: "kW"
device_class: power
state_class: measurement
state: >
{% set GtH = states('sensor.s10e_pro_consumption_from_grid') | float %}
{% set GtB = states('sensor.s10e_pro_energy_charged_from_grid') | float %}
{% set HtG = states('sensor.s10e_pro_export_to_grid') | float %}
{{ (GtH + GtB - HtG)|round(2) }}
- sensor:
- name: "Batterieleistung"
default_entity_id: sensor.batterypower_calculated
unit_of_measurement: "kW"
device_class: power
state_class: measurement
state: >
{% set BatC = states('sensor.s10e_pro_battery_charge') | float %}
{% set BatD = states('sensor.s10e_pro_battery_discharge') | float %}
{{ (BatD - BatC)|round(2) }}
of course you’d need to change the underlaying sensors to the ones corresponding to your installation.
The Sensor Attributes are derived from Home Assistant Energy FAQ
