How do I get a plausible energy dash?

Hello, I have just discovered HA and just yesterday I tried to integrate Shelly Pro 3EM, 2 Growatt MIC 3?00TL-X and a Zendure Hyper - more or less successfully. HA is a core installation on a 4-series Pi, which has other things to do.

So I have two different strings of PV modules, each in a Growatt MIC 3000TL-X and a 3300TL-X. EEG compensation since 2009, self-consumption is compensated.
The Shelly is directly behind the main meter, so it can see what I use or supply.
Then came the plug-in solar device with 4 more modules and 3 batteries. The energy generated is primarily delivered to the house when the Shelly reports a supply from the utility company. If the energy generated is higher than the household’s needs, the battery is charged. If there is a need in the household, the battery is discharged.

Now I want to display all of this correctly in the energy dashboard.
under power grid->grid consumption I have “sensor.shelly*_total_active_energy” in kWh

  • under power grid->grid feed-in I have “sensor.shelly*_total_active_returned_energy” in kWh
  • under PV modules->solar production I have “3000tl_x_export_ins_netz_heute” and “3300tl_x_export_ins_netz_heute” in kWh as well as “sensor.pv_produktion” in Wh (here is the first problem)
    • The latter is an integral sensor helper as a left Riemann sum of “sensor.solarflwo_solar_eingang_leistung” in W (feeds from MQTT “solarInputPower” in W
  • in the battery storage at home->battery systems I then have “battery charge” and “battery discharge” again as integral sensor helpers with a left Riemann sum (Wh) from MQTT “outputPackPower” and “packInputPower” in W
    I should probably convert the Zendure values ​​to kW. That should work in mqtt.yaml with e.g. “value_json.solarInputPower | float / 1000”. Right?
    Have the helpers and sensors been thought out and selected correctly? Are they also entered in the right places?
    I’ve somehow lost track of the complexity. Furthermore, the energy distribution and
  • the graph in the energy dashboard are not entirely conclusive for me:
  • the energy distribution has not yet shown me a flow from solar to home
    in energy consumption, “Shelly supply” is positive, “Shelly delivery” negative - so far so good
    • “battery charge” is negative - I could perhaps follow that
    • “battery energy used” is also negative - shouldn’t that be offset against consumption instead of being allocated to generation/storage
    • in another hour, “battery energy used” is suddenly positive - why is it sometimes one way and sometimes another
  • “Self-used solar energy” is 0, which is wrong
  • so the calculation of self-sufficiency in % is probably also wrong
    I would be very happy if someone could help me think about this and unravel my Gordian knot. Thanks for your efforts in advance.

Regards, Ronny