Removing sensor permanently and/or deleting historic data

Hello,

I have been playing and trying things with Home Assistant for a few weeks now and in the process renamed sensors, moved them and changed them to figure things out. Now I am stuck with many sensors that are no longer configured in configuration.yaml or have different names. How can I permanently and fully remove unwanted or unused sensors ? Same way I have sensors that I am still using but had to figure out locatio, mounting etc so there are a lot of useless readings that are of no value, how can I remove historical data from a sensor ?

I have used google to look for this but have not found any straight fwd answer, I found a great variety of ā€œanswersā€ that talk about very different ways none of which I understand or I donā€™t have the files in question on my HA system etcā€¦

Kind Regards
Jan P.

PS: Here my versions:
OS Version: Home Assistant OS 9.3
Home Assistant Core: 2022.11.1

1 Like

Hello again,

I am surprised there is no response. I can surely not be the only one that wants to remove devices that no longer exist from HA or delete historical data. Can nobody help in this matter ?

Kind Regards
Jan P.

Entities, that are not longer existent, can be removed under settings ā€”> devices&services ā€”> entities.

Historical data can be removed by using the purge service under developer tools ā€”> services.

5 Likes

Hello pedolsky,

unfortunately that does not work cause the switches that I like to remove are snmp switches that dont allow for a unique_id to be set. The GUI does not seem to be the place for me in this instances. How can I remove entities that can not be managed from the GUI ?

Kind Regards
Jan P.

Where exactly are you seeing the snmp sensors whose configuration you removed from configuration.yaml?

For example, do they appear in:

  1. Developer Tools > States
  2. Settings > Devices & Services > Entities

Hello,

I am a bit puzzled now TBH. I was trying to find the entities in the states like ā€œDeveloper Tools > Statesā€ where I had seen them before but they are gone now. In fairness because of what I experienced I have started working on a HA VM installation on my server instead of the R-Pi cause that gives me the much easier backup option on the VM image. Is there a delay between me changing the config.yaml and what the GUI shows ? The issues I had with non existing states on the R-Pi appears to have vanished. On the VM installation I manually give everything that accespts it a unique_id now to avoid issues.

So in short, I have no states showing that are no longer configured now. If I know it just takes time to disappears I can deal with that and move on.

Thank you for your patience.
Jan P.

Why I just found out is in the tab STATISTICS those sensors will show up as having no state (or something) with a button FIX ISSUE. Clicking that will give a popup with the option to remove the sensor statistics and long statistics.
This fixed it for me! (had a lot to delete :smiley: myself)

1 Like

Where do I find this ā€œSTATISTICSā€ tab?

In the developer tools screen the most far right tab

1 Like

Many thanks.
I was going round in circles looking for this

This did not work for me. Although I can select the specific Entities under Service/Recorder: Purge Entities and execute ā€œCall Serviceā€, they are still showing up, even after rebooting.

finally did you delete the sensor without unique_id ?

hi ,my broadlink door sensor is the same situation. i have renamed and I am going to delete the old sensor name and then let it can be found the new sensor name.
finally did you delete the sensor without unique_id ?

Currently Iā€™m in the same situation. Iā€™ve created a template sensor for the outside temperature and afterwards, I changed the name, because it was not really matching.

When I now type ā€˜outsideā€™ I do see the old and the new sensor.
I was able to delete the second Entity, but the sensor remains and it only tells me that it would not have an unique_id. This is clear, because itā€™s been created in the configuration.jaml, but how to I get rid of the wrong one now?

Were you able to delete the sensors u wanted to remove without the unique_id ?