Energy Dashboard cost/compensation calculation stopped working when I upgraded to 2021.9


I noticed my cost calculation in Energy Dashboard stopped working as soon as I upgraded to 2021.9 as shown in the image below:


This feature was previously working fine in 2021.8.
I did some troubleshooting and found out why.
This is a post mortem of how the issue was caused and how I fixed the issue.

How the issue was caused:
When Energy dashboard launched in 2021.8, I had not yet changed my currency from the default EUR under Configuration / General / Currency.
My local currency is AUD.
When long term statistics was initialized in 2021.8, Home Assistant assigned the current currency value to Energy Dashboard which was EUR at the time.
Once I noticed the EUR symbol in Energy Dashboard, only then did I take steps to change the currency to AUD.
Changing the setting was easy enough and had an immediate impact on the currency smybol displayed in the Energy Dashboard.


Once 2021.9 came out, Energy Dashboard noticed that the EUR unit was not the same as my current currency of AUD and decided to stop recording costs all together.
I can understand why, because the units need to match in order for calculations to continue.

How I verified the issue:
Installed this

How I installed it
Supervisor / Add-on Store / SQLite Web / Install / Run / Open Web UI

Once running, I did this:
statistics_meta / Query

FROM "statistics_meta" where unit_of_measurement = 'EUR'

These EUR units need to be changed to AUD so that Energy Dashboard resumes cost caculations.

How I fixed the issue:

update "statistics_meta" 
set unit_of_measurement = 'AUD'
where unit_of_measurement = 'EUR'

After that my energy dashboard started recording costs correctly again after 1.2 hours (1h 12m).


Seems this solution can also be used to fix NULL unit_of_measurement preventing integration energy sensors from being selected in energy dashboard.



Thanks for this post, I had exactly the issue you described and have been trying many things to resolve it, updating the entry as you described sorted it.

One addendum that I did was to remove all the stats generated to date on that stat ID, because it’s been nearly two months since this stopped working I suspect that the yearly cost stats would be completely wrong so may as well start again.

1 Like