Energy cost calculation wrong

I’m using the Smart Meter Texas integration with a fixed kwh cost.

If the integration gets the data correctly every hour, the energy amount and the cost amount match up for the day.

If there is an error for one or more hours, then the next energy use number that does come through appears to include the previous missed readings, which is great. However, it appears the missed readings are not added to the cost calculation.

For example, on a day when it works I have 24 readings and the cost adds up correctly. So I have 10 cents as the cost and a total of 39.74 kWh shows a cost of $3.97.

But the next day I had 7 readings, then it missed the next 5 readings. The reading after the missed 5 was huge, so I assume it was just the total of the last 5 plus the current one. But at that point the cost is messed up and it only adds cost for the current one. At the end of the day it shows 35.94 kWh with a total cost of $2.81 when it should be $3.59.

UPDATE: After watching today’s readings, it appears to only miscalculate if there was more than one previous reading missed. If only one reading was missed, the next reading picks it up correctly and the calculation is correct.

I have no idea if this is an issue with the integration or with the Energy dashboard, so if it’s the integration then maybe a mod can move the topic to Integrations.

Different day from above example pictured — I have it set to 10 cents per kwh, so Cost should be showing $2.58:

I have a similar (maybe the same) issue. I am using the Slimmerlezer+ and occasionally it will lose wi-fi signal. This shouldn’t matter because when it comes back online Home Assistant gets the new meter reading; it’s not like they come in at a regular schedule normally anyway. However I have noticed that when it is offline for long periods the cost calculation is completely wrong.

Here’s a particularly striking example that occurred when the meter came back online after being offline for a couple of days. I’m using an entity to store the cost per unit and it didn’t change in this time so these 2 days should have the same cost if you divide the cost by the energy but as you can see they are totally different. The actual cost per unit both days was 0.1536199 (so 12 Mar is roughly correct but 11 Mar is way off):

I suspect that whatever the underlying cause is it’s also causing this issue - Energy Dashboard - wrong values caused by CO2signal · Issue #79774 · home-assistant/core (github.com)

hello guys,

It seems i have the same issue, but i don’t know if you have already found an way to fix it or not yet ??
I stopped air conditioner for about 1 day, then i turn it on again. The energy cost for the first hour after it was turned on is obviously wrong.
I have a few similar occurrence like this, all happens after the AC turned off for a few hours then turned on. Then the calculation of the next hour seems gone crazy.