Having a look at my config it seems that need to add a new sensor type that will use the power sensor as a source and do the calculations for the total energy. Below is an example of how mine works
- platform: template
name: ${disp_name} Total Solar Watts
id: totalSolarWatts
lambda: return id(solarwatts).state ;
accuracy_decimals: 1
unit_of_measurement: W
icon: "mdi:flash-circle"
update_interval: ${update_time}
- platform: total_daily_energy
name: ${disp_name} Solar kWh
power_id: totalSolarWatts
id: solarproducedkwh
filters:
- multiply: 0.001
unit_of_measurement: kWh
state_class: "total_increasing"