Template sensors are still there after they are being removed

Individual files - I’m limited atm to browser access to the files (with no ‘find in file’ function) but it’s not that complex.

You said you used VSCode addon though?

… and they have gone!

Thought I’d check before forcing a browser cache refresh and the entities are no longer listed. I’ve done nothing - no restart, nothing edited, nothing deleted.

Only thing I can think of is it’s just over 24 hours since the history was purged. Timing?

(I don’t use vs code through my Android tablet, just on a pc which is remote to me atm)

Thanks for taking the time to assist - appreciated.

Same problem here. Experimented with some sensors in a template.yaml (without unique ids), now got it working with slightly other entity-names, but although the old senors are not mentioned anymore in the template.yaml, they still persist - well, at least somehow they do: I found them for example in the energy-dashboard in a dropdown-box when configuring a gasmeter. But: They are neither available in the entities tab nor when using “Recorder: Purge Entities" and selecting an entity nor in a new automation. Strange.

So I tried:

  • Restarting HA
  • Browser cache cleared
  • Entities tab: Not found there (even looking for hidden and disabled entities, too)
  • “Recorder: Purge Entities": I couldn’t select these sensors, they are just not appearing in the dropdown-box there. I entered them manually in YAML-mode and called the service, got a green checkmark, but they are still there. No errors in the logs.
  • Search all files in /config/ for the name of the entities → Found nothing. I tested that the files in .storage are searched as well.

It’s been a week since I removed the sensors from my template.yaml.

Any other ideas?

There’s nothing else it would be. If you waited a week, wait 3 more days.

[edited to reflect new knowledge that long term statistics never deletes temperature and energy in particular]

Experiencing the same behavior - moving some template sensors to the GUI as helpers, but they persist over reboots. Thought I was going crazy and found this thread.

I had done two batches of moving, and the first batch all worked great. Delete from config, restart, add as helpers (sometimes having to delete the old entity).

Four sensors didn’t behave well, and they are either energy or temperature. So I wonder if this is related to a reference from the energy dashboard, statistics, or something.

All are found in:
.storage/homeassistant.exposed_entities

And the two energy ones are also referenced in
.storage/energy: "stat_consumption"

Purging the entities ALMOST did fix it for me, but I suspect that some folks don’t wait long enough for the purge to finish - if you keep a lot of data, it would take a while…then the entities will be gone from most parts of the UI.

But in the end, while I couldn’t search out the entity in the developer state console, my old references to the entity in a dashboard still worked (stuck on the last value).

I used to think I had a way to handle better, but I can’t think of one, since I understand the challenge of the long term statistics - don’t want 2 years of history to drop over a typo.

Digging up this old post since I had the same issue and maybe found a solution.

So I did everything stated above (searched files, purged the entity). What helped in the end was to delete the helper through the UI (no, it was not originally defined via UI). Going to the settings of the helper in UI and hitting delete, removed the entity once and for all.

Hope that helps somebody…

1 Like