Big problem with HomeWizard. The upgrade disabled the t1 import entities and generated a new entity without history. So I was missing complete history. Swapping statistics id’s in de database resolved this. But utility meters based on the T1 entities also broken. Cost me already 3 hours to correct things in the database and statistics. Had to correct 17 devices…
What I noticed is that it generated dutch names i.s.o. english ones. And based on the device name. So maybe language setting related? For some devices which have been renamed in the passed I have half the entities with the previous name, half the new name, half in english and half in dutch. A mess!
My solution in the database, example for the wasmachine:
Get the ids:
select * from "statistics_meta" where statistic_id like "%was%import%"
Result:
435 sensor.wasmachine_total_power_import_t1
1196 sensor.wasmachine_totale_energie_import
3 sql commands to swap the ids
update "statistics_meta" set statistic_id="sensor.wasmachine_total_power_import_t1_old" where id = 1196
update "statistics_meta" set statistic_id="sensor.wasmachine_totale_energie_import" where id = 435
update "statistics_meta" set statistic_id="sensor.wasmachine_total_power_import_t1" where id = 1196
I did the same for states meta:
SELECT * FROM "states_meta" where entity_id like "%was%import%"
Result:
252 sensor.wasmachine_total_power_import_t1
4592 sensor.wasmachine_totale_energie_import
3 sql commands to swap the ids
update "states_meta" set entity_id="sensor.wasmachine_totale_energie_import_old" where metadata_id = 4592
update "states_meta" set entity_id="sensor.wasmachine_totale_energie_import" where metadata_id = 252
update "states_meta" set entity_id="sensor.wasmachine_total_power_import_t1" where metadata_id = 4592
Oh, and restart Home Assistant afterwards. It caches the ids…