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!



  • I know this thread is old, but it might help others in future searches.

    I simply deleted the child I no longer used from the persistence file, saved it and restarted Home Assistant.
    The child was gone.
    If you want to change a child to a new sensor this also works.
    After restarting Home Assistant, power up the node and the child will present itself and update the persistence file.



  • With the latest MySensors integration this is how to delete entities:

    • disable the MySensors integration
    • delete the entities in Home Assistant (note you have to change the option to show the disabled entities since the integration is disabled)
    • delete the entities from the persistence file (if you skip this step the entities will pop up again)
    • start the MySensors integration

    Hope it helps someone!



  • @electrik how do you delete entities in Home Assistant?

    After I disable integration I can navigate to objects and delete the objects corresponding to the sensors but I can't find the way to remove node itself.

    I've upgraded to the latest HA build (2021.12.10) but there is still no "remove" button for the MySensors devices.



  • Have you also deleted the items from the persistence file?
    What do you mean with objects in this case? Entities?



  • @electrik yes I have. And yes, "objects" meant to be "entities" in my previous post. My inactive devices still present at the device list and I have no options to delete them via the HA interface whereas they have no related entities and json records.



  • Yes now I understand what you mean, the nodes itself don't go away on my installation either.


Log in to reply
 

Suggested Topics

  • 1
  • 2
  • 8
  • 1
  • 5

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts