I can manually change it to Wh in the YAML section under the STATES tab, which corrects it for a few seconds. But then it reverts back to the incorrect state after a refresh.
Another reboot and another correction. I’m starting to wonder if this is just a timing thing with the plug - will it keep flipping back and forward between kWh and Wh depending on use for the day?
It’s now reporting energy correctly. But, I now need to delete the old data (or just reset the counter) but can’t figure out how.
The “adjust a statistic” pane just spins forever.
Try clearing your browser cache then give the statistics adjustment another go. I’m assuming there are no more FIX ISSUE options?
Correct. Nothing more to fix. The unit of measurement and actual reported units are now both, correctly, kWh. Which is awesome!
Now I just need to bin off the historical data which came in as incorrect units. I’ve tried the Dev Tools > Actions > Recorder: Purge Entities action (to erase everything for the summation entity) but it didn’t appear to do anything.
The Adjust a Statistic pane now shows the values, but it would take me aaaaaages to manually set the old entries to something suitable, especially when they’re not in order. I just need the old data gone.
Browser cache reset (switched to Brave in private browsing mode just to be triple-sure) so all good there.
I can see other posts that suggest messing about the the database to clear old data, but that’s a line I’m not happy to cross.
Yeah there is no easy way to delete past statistics. Well maybe one way.
Change the entity id in the settings pop-up page. Restart.
You may get an error saying that statistics could not be migrated to the new entity id. If you do this is good.
Delete the old entity id from the entities list if it is there.
A FIX ISSUE to delete statistics for the old entity id should occur (maybe after an hour or so) as the entity no no longer exists. It will give you the option to delete all stats in one go.
You can then change the entity id back to what it was if you want.
Good idea. Just tried and it appears to take the entity name change in its stride - no errors. The name just changes everywhere the old one was.
I’ve manually set all the values before 30 minutes ago to 0 kWh, and this is reflected in the long-term “show more” graphs. But the History graph still shows all the old values.
That will disappear after 10 days.
Damn. They must have fixed that bug. It was useful occasionally.
Good to know. So it’s a separate database that that long-term one? That’s surprising as I’d expect them to both pull from the same pot.
Separate tables in the database. LTS (long term statistics) are kept forever. State values are kept for the recorder purge_keep_days
setting (10 days by default).
Even the “purge” set to one or zero days appeared to do nothing.
With your help I appear to be close to what I need now. HA is getting the correct units from the plug and I’ve setup daily/weekly/monthly “Utility Meters” for the costings, so I’ll see how that goes.
I don’t know where the “cost” sensor came from, but I’m not asking too many questions at this stage.
I feel the bug setting in - I may be buying more meter plugs and invest in a “pulse LED” device for the electric meter!
Thanks again, @tom_l
Did you have the repack
option set to true
?
There didn’t appear to be a repack option. I just checked again, in the UI and YAML, but “repack” isn’t there.