Auto consumed energy cost Card - Help / Question

Hi!:

I´m new so, please be patience. My English is bad.

I´m using energy card, and everything works fine.

This is today:
image

This is the hourly usage of the energy.

image

And the costs table is the following:
image

The total energy used is 11.9 kWh.

The cost of the kWh from the grid is $120, so the total cost (Consumo General [kWh]) is 9.7 x 120 =$1.140 aprox. (Correct in the Summary cost table)

The inyected energy is 1.1 kW al $65 each kWh, so, the income is $ 1.1 x 65 = $ 70 (Correct in the summary cost able)

The question is:

I save all the auto consumed energy (shown in red the Energy use graph). It´s 2.2 kWh, because is the total generated (3.3 kWh) minus the inyected energy (1.1 kWh). But this saving are not show in the cost table. This energy cost me $120/kWh x 2.2 kWh =$264

So, the correct total cost must be:
General Consumption 9.7 kWh x $120 = $ 1.164
Inyected energy - 3.3 kWh x $65 = - $ 214
Autoconsumed energy -2.2 kWh x $120 = -$ 264

Nobody is going to pay me the autoconsumed energy ($264), buy I think it is an intresting number to know your savings.

Any Idea how to get it?

Thanks!

You would have to create a template sensor.

https://www.home-assistant.io/integrations/template/#state-based-template-binary-sensors-buttons-numbers-selects-and-sensors