Calculating self-consumed energy for house, heat pump and car separately

Hi,

I am rather new to HA, apologies for maybe overlooking existing solutions. I am using HA to visualize and analyze my homes energy consumption and production. There are two PV systems with overall 17kWp and a heat pump and an electric car as the main consumers.

For all these I would like to measure the energy usage from PV and the grid separately and maybe also calculate the self-consumption as a ratio. Also, energy for the heat pump during day and night separately would be of interest.

Is there an existing solution for that? The energy dashboard does not give that level of detail. Do I have to write my own sensors? Or would it be better to extend the energy dashboard? My programming skills are somewhat rusty and I have no experience in HA…

Any ideas/advice much appreciated!