I have some trouble with my MQTT (from OpenMQTTGateway) auto discovery feature.
In auto discovery mode it creates a lot of devices, in a week well over a 150 devices mostly from my neighbors. On the other hand, by disabling auto discovery you would need to create everything by manually and even parse JSON-objects by hand.
Is there a middle ground here? For example define a list of …/config topics and let “auto discovery” add them and nothing else?
You can enable auto discovery and disable it after. Once the devices are created they should be persisted as they are published with a Retain flag to the broker.
What type of devices are you seeing being created?
Thanks for the reply @123. I even if the filtering could be done in the upstream devices I think home assistant could benefit from such a feature instead. There seems to be a lot of posts regarding the same thing and fixing all of them upstream seems to be harder than filtering downstream.
I get a lot of my neighbors temperature/soil/security sensors and they do seem duplicated, just like discussed in the docs - but I don’t think anyone has physically changed batteries because it’s just too many. I’ve removed every device now but I can post an update when I’ve let it run for a while so that I can see if there is anything else sticking out.
Can you link to at least three of the “lot of other posts” because your’s is the first one I have seen and would like to know which other external systems are involved.
Feel free to post a Feature Request but I have my doubts it will attract developer attention. The whole point of MQTT Discovery is to discover. The onus is on the other end to use it properly or not.
…and since there wasn’t an “native home assistant way” I figured that a filter on the HA side would be beneficial but the real fix for those posts is to enable the “delete” button in HA and somehow ignore or purge the topic on submit. That would probably be a nightmare to implement.
I’ll see if I can handle my particular issue in OpenMQTTGateway instead.
The first three are ancient and all have nothing to do with your request to prevent autodiscovery.
They ask how to delete entities they no longer need due to obsolescence or faulty configuration information. Due to the age of the posts, some of the solutions are no longer needed, applicable, or have been superseded by new methods.
Purging a discovery topic isn’t effective if whatever published the topic publishes it again.
Personally, I feel it’s the publisher’s responsibility to only publish the entities that ought to be discovered, not the subscriber’s responsibility to cherry-pick which ones to discover.
Nevertheless, post a Feature Request detailing how the rejection process would work. If a volunteer developer thinks its worth their time, and if the development team it’s a worthy addition to Home Assistant, it’ll be included in a future release.