WTH - The energy page does not support net metering (hourly or daily) when calculating energy cost

For people with solar panels it’s common that the price of energy is not as straightforward as kwhImported * buy-price - kwhExported * sell-price. Many implement net hourly mettering, either by day or by hour.

For instance, if within a day(or one hour) you imported 10kwh (at 0.20€/kwh) and sold 8kwh (at 0.15kwh), home assistant think you owe 0.8€ to your energy supplier, but with net metering you substract what you exported from what you imported and then whatever resulting the net balance is is what you multiply by the unitary price.

In the example above, with net metering it’s like if you imported 2kwh, which at the price of 0.20€ means you owe your energy provider only 0.4€, not 0.8€.

In some countries that net balance is daily, in others (mine, spain) it’s hourly, but the concept is the same.

It would be great if the energy section could be configured to calculate prices and show graphs with net metering enabled (should you choose to with a configuration option). It would give us more accurate expense estimates.

Following this as I have been searching for a solution the last days and was really hoping that I was just missing something.
I have set up hourly utility meters for imported as well as exported kWh, these are reset every hour.
How can I calculate the hourly net import or export kWh based on these and show in the energy dashboard?
A trigger set at xx:59:59 is of course one solution but I believe there is a better solution?

In Czech Republic and Slovakia,it applies metering within 15 minutes interval, moreover every line/phase separatelly.

There is a custom integration that does this: https://github.com/MiguelAngelLV/balance_neto/blob/e51ba4b539d22dcdf9bd9a741a37ae3471db4150/README-en.md

It works great here in Poland with 1 hour interval I think it has an option to set it to 15 min as well, not sure if daily balancing is available.

Since there are so many different net metering slutions in the world I think it would be hard for HA devs to get them all together to work. Even here in Poland only some of clients with panels have net metering, all depending on when they got the solar panels up and working.

FWIW I also ended up using that custom integration and it works fine.