Summary
Energy dashboard does not calculate costs for water correctly. The unit conversion for the quantity of water correct, but the unit conversion for cost seems to be incorrect.
System: Home Assistant 2023.5.4, Supervisor 2023.04.1, Operating System 10.2, Frontend 20230503.3 - latest
Details
My water meter is implemented with a template sensor measured in (the ridiculous unit of) hundred cubic feet, CCF.
Water costs US$17.61/CCF and this is what I’ve entered on the dashboard configuration card:
On the energy dashboard we can see the rate being used is ($8.23 / 467.2L ) = $0.01761/liter
Question
Is this a bug or am I just being dense?
It looks like the conversion is simply dividing by 1000, mistakenly converting from cubic meters to liters? There are about 2831.7 liters per CCF.
This only seems to affect the water tracking on the energy dashboard. My gas utility is also measured in CCF and the costs are in $/CCF just like water. However, the quantity and cost conversions are correct for gas.
It’s not a bug. The math is your current momentary value multiplied by the current momentary price and then summed together. You are most likely missing a price for the bulk of your water values. I’m assuming you added the price much later. Anyways, just wait and the values will be in line with what you expect.
I’ve tried deleting the sensor and it’s cost tracker, rebooting, and re-creating them, but it still creates this statistic with units of m3, not CCF as it should.
My natural gas sensors have similar sensors and statistics, but their units are correct:
You still need the price in the database. I have a sensor that just simply outputs the price per liter and I have it recording in the database. That way, when it rolls up the liters * price, it has a value to multiply against instead of multiplying against zero.