Deleting Device IDs

In the last update (2025.6) it was mentioned that we can now “restore the ID of an entity to its original value”.

Question: Resetting device IDs to default - will that affect/break the Logbook/History for the device(s)?

It’s talking about entity IDs (not device IDs) and it doesn’t have any effect on statistics because the states and statistics have numeric IDs and there are “meta” tables that map the name to the id.

Here’s an entity and its associated id:

sqlite> select id from statistics_meta where statistic_id = 'sensor.irrigation_water_monitor_water_pressure';
id
---
267

So the statistics ID for that entity is 267, and all the associated stats are based on that id.

Here’s the number of stats I have for that entity:

sqlite> select count(*) from statistics where metadata_id = 267;
count(*)
--------
6351

Now, if I rename the entity in the UI and add _foo you can now see that 267 has the new name associated:

sqlite> select statistic_id from statistics_meta where id = 267;
statistic_id
--------------------------------------------------
sensor.irrigation_water_monitor_water_pressure_foo

And then clicking on the reset button it reverts back, and the count is still the same.

sqlite> select statistic_id from statistics_meta where id = 267;
statistic_id
--------------------------------------------
sensor.irrigation_water_meter_water_pressure

sqlite> select count(*) from statistics where metadata_id = 267;
count(*)
--------
6351
2 Likes

Mmm… I’m not sure that’s true.

The link between an entity and its statistics is purely done through the entity ID (it’s one index on the statistics_meta table)

So, unless the restore also change the name in the stratistics meta table, the link between entity and statistics will be lost.

See above.

1 Like