can't remove unused sensors from HA



  • I just got my gateway, first sensor, and an HA automation working (hass.io on a Rpi with serial gateway). In the process, I have a couple old versions of the sensor showing up in HA that I can't figure out how to remove. They appear in the GUI and in Developer>States>Entities, but they do not show up in Configuration>Entities list where I could delete them. (In fact, none of the mysensors sensors or gateway show up in the Entities list, even with Show Disabled Entities turned on).

    I've tried using the Configurator HA add-on to find a config file that lists the devices, but can't find it. Searching forums suggested that I need to shut down HA and edit a config file in command line, but not 100% sure that suggestion was appropriate for my problem. I am capable of that, but really hoping there is an easier way, as I expect this to be a common situation for me as I am prototyping and building out my HA setup. Appreciate any and all suggestions!



  • @Jake-Wills I believe you have a persistence file configured for the MySensors configuration?

    For me, the following steps worked:

    1. Stop home assistant/ HassIO
    2. Locate the persistence_file entry in your configuration.yaml
    3. Open this file and identity the entries you want to delete. Remove them from the file and save.
    4. I also cleaned up my database. It should be located under the HA/HassIO config directory and named .homeassistant/home-assistant_v2.db. Open it with sqlite3 and delete all entries from the states table of sensors you deleted. It might be you don't need to do this step but I'm not sure. If you're unfamiliar with databases, just skip this step and try out what happens.
    5. Start home assistant / HassIO


  • The persistence has multiple downsides.

    The biggest for me was, that old sensor values are reported as new when restarting home assistant.

    The downside is, that the presentation of your nodes has to be more robust. If you use persistence, you do not notice if your nodes only present at startup. Without persistence, they will not reappear in HA, if they only present once after powering on.

    This might have changed meanwhile.

    Perhaps you are also affected from

    https://www.home-assistant.io/blog/2020/01/15/release-104/#improved-entity-handling-on-startup

    I am currently not running the latest HA version.

    Regards
    Leonard



  • Thank you @fabyte ! I had mostly figured out the persistence file thing... had to jump through some hoops to change from pickle to json so I could edit it -- in the process cleared all my devices, but now I am set up to remove devices easily as i test and build out. Did not think about the database file... will check that out too. Appreciate the help!


Log in to reply
 

Suggested Topics

  • 8
  • 3
  • 5
  • 2
  • 9
  • 4
  • 2

89
Online

9.5k
Users

10.1k
Topics

105.2k
Posts