core: Currency/cost change isn't reflected in Power Total Cost, stuck at zero
The problem
After changing currency in HA Settings - General to reflect my actual currency (CZK) and adjusting cost of energy to that currency, the Total Cost does not increase anymore. It is stuck at 0.00.
What is version of Home Assistant Core has the issue?
2021.9.2
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
Energy
Link to integration documentation on our website
https://www.home-assistant.io/docs/energy/electricity-grid/
Example YAML snippet
No response
Anything in the logs that might be useful for us?
nothing relevant in logs
Additional information
I tried to remove and re-add my device (it’s a simple zigbee power plug) from energy monitoring, problem didn’t get fixed. Tried modifying the HA database as instructed by a HA developer with
UPDATE statistics_meta SET unit_of_measurement = “CZK” WHERE statistic_id = “sensor.energy_from_grid_cost”; and DELETE FROM statistics WHERE metadata_id = (SELECT id FROM statistics_meta WHERE statistic_id = “sensor.energy_from_grid_cost”);
but to no avail.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 21
I have this same issue :
edit: fwiw this is fixable as above using the default sqlite database, you don’t need to have mariadb installed.
Sqlite db location is in config, for me it was just a matter of :
sqlite3 config/home-assistant_v2.dbfrom there you can run the commands from the above post so…
select * from statistics_meta order by statistic_id;For me items with id 40 and 59, obviously in the following sql swap out the id(s) for the ones you have.
Set the items to the corrected currency, for me GBP :
update statistics_meta set unit_of_measurement="GBP" where id = 40 or id=59;Verify the update :
select * from statistics_meta order by statistic_id;delete from statistics WHERE metadata_id = 40 or metadata_id=59;Restart HA and an hour or so later :
I was able to fix this using the instructions in the OP without nuking my recorder db (mysql). Using the
homeassistant/home-assistant:2021.9.6docker image.Here are the steps. I updated from EUR to USD.
Step 1) sanity check the unit of measurement that’s in the DB already
Step 2) update to your desired unit
and verify that the unit_of_measurement is what you want it to be:
Step 3) remove old stats
Step 4) restart homeassistant. This may not be necessary.
Step 5) wait a couple hours. You’ll still have your old long-term energy consumption data, but new data should start populating price
Same here… i’m using a static price with peak and offpeak… it was calculating price fine on September 1st… then from the 2nd i’m not getting any price calculation…
My recorder options havn’t changed…
system_health: recorder: purge_keep_days: 30 exclude: event_types: - themes_updated