Energy Dashboard - Energy sources graph

Energy Dashboard configured as follows
Electricity
Shelly PRO3EM 400 A on grid side with two increasing counters: one for energy from grid and one for energy to grid

Photovoltaic
One increasing counter for total yeld [sum of 4 inverter total yeld]
One real-time counter for real time production [sum of 4 inverter real-time ac power]

Everything seem ok except for Energy sources graph
In the Home Assistant Energy dashboard, the consumption incorrectly matches the solar production. What’s strange is that the graph sometimes loads correctly, with consumption not matching production. Why does this happen? I’ve already done Ctrl+F5 and switched browsers

any advice for wrong "power sources" graph where "consumption" matches with solar production?
solar production is ok
consumption is not ok!!!!
but in the graph "Electricity usage" readings are ok

grid connection

counter from grid
state_class: total_increasing
unit_of_measurement: kWh
device_class: energy
friendly_name: shellypro3em400-ecc9ffe72b00 Energia

counter to grid
state_class: total_increasing
unit_of_measurement: kWh
device_class: energy
friendly_name: shellypro3em400-ecc9ffe72b00 Energia restituita

solar panels

total yeld
state_class: total_increasing
unit_of_measurement: kWh
device_class: energy
friendly_name: SMA Energia Totale V3

real time AC power
state_class: measurement
unit_of_measurement: kW
device_class: power
friendly_name: Potenza Totale Inverter AC kW

The graph you are referring to in your screenshot is the (live) power graph, not (historic) energy. The units are kW.

The Energy Dashboard works with Energy, but now has the option for power also. This requires a power sensor for the solar power, and another power sensor for the grid power. The grid power sensor must be a single sensor with positive values being power imported and negative values being power exported. However there are also now options for using two sensors and for the inverse (+ve output and -ve input).

You have all the energy sensors - grid import, grid export, solar energy. You have one power sensor which I assume is for the solar power. Without a grid power sensor, yes your power graph will show all solar with consumption = solar.

As I also have a battery system, I need a power sensor for the solar, the grid, and for the battery. These three provide the necessary values for the power graph, and consumption is calculated as

Consumption (power) =
Solar power + Grid Import power + Battery Discharge power - Grid Export Power - Battery Charge Power

where
Grid Import power - Grid Export power = Grid Power
Battery Discharge power - Battery Charge power = Battery Power

so

Consumption power = Solar Power + Grid Power + Battery Power


Ok
Now I understand what I was missing, a power sensor
I added power sensor,
if >0 energy from grid
if <0 energy to grid

Thank You


finally!

Thank You!