Extract "Grid Total _ Cost" not correct

I found a FAQ HA energy FAQ what is very use!!

but #8 is not working for me:
when i look at the _cost en _compensation, the price is not right, the reset moment is also not right. How can i get the grid total cost?

I goal is to use " -€0.43" in my custom dashboard

the _cost is not showing: 0.25

the _compensation is not showing: -0.68

If you look at your cost and compensation sensors for today, you see visually the increments were 0.69-0.40 for cost and 0.85-0.17 for compensation. So the total cost was approximately 0.69-0.40-(0.85-0.15) = -0.41, so that’s your -0.43 (small difference because I read the numbers from the chart).

So what you need is a template sensor or helper that computes the difference between the cost and compensation. And then you can use that in the chart without changing anything.

So if I understand it right

I take the current amount minus situation of 0:00

That’s making sense :sunglasses:

No you take netto = cost - compensation. The card will compute what the total amount netto for the time period 00:00 - 23:59 is. This is netto (at 23:59) - netto (at 00:00). This is the same as the energy dashboard does

i made a helper

but de numbers still not right

{% set compensation = states("sensor.p1_meter_energie_export_compensation")|float(3) %}
{% set cost = states("sensor.p1_meter_energy_import_cost")|float(3) %}

{{ cost - compensation }}

Template looks okay. So if you put this template sensor into the chart it will work.

it’s not working look at the card on the right side at my preview post

what i can do is make 2 utility meter and reset the every day,
it’s very ugly but don’t know how i can make it work, it should work right out of the box i was hooping

but i’m afraid that it not going to work, it looks like the building in sensor will be reset at the middle of the day, i don’t understand what is going on

Have you read Q11 in the FAQ? Use the charts there with this sensor you just made and it should work. It will take some hours to calculate statistics though.