Allow use of up/down counting energy meter

I have an old-school electricity meter (I read the numbers using this cool project that counts up when using power from the grid (as you’d expect) but when our solar panels are providing more power then the home is using, the meter counts backwards. effectively returning power to the grid.

It seems there currently is no way to correctly set this up since I have no separate entity to provide the values separately.

I do have a solar power production sensor too so it should be possible to calculate the consumed - returned values

You can do this yourself.

Use the utility meter to follow your grid meter. It only counts up. Add this to your energy dashboard as the grid consumption sensor.

Is your solar production meter an energy meter or instantaneous power meter?

if it is an energy sensor you can add this directly to the energy dashboard as a solar production sensor.

if it is a power sensor, then you will need to integrate it to get energy:

Thanks for your reply !

I’m sorry, but I fail to see how this results in me having separate consumption / return to grid sensor values ?
If for example the sensor reads 28854.3 and the next reading is 28854.9 it should add 0.6kWh to grid consumption and if the next reading is 28853.7 it should add 0.6kWh to return to grid.
BUT if for example the sensor goes down by 20kWh during a sunny day and then starts rising again it should again add that to the usage sensor even though the number is lower then the one the day before and one that ONLY counts up will not do this if I’m not wrong.
Please re-read my initial post, I believe you don’t quite get what I’m trying to accomplish.