MQTT and selective auto discovery?

Hi,

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?

Best Regards --David

There’s no selective MQTT Discovery.

Home Assistant creates whatever entities and devices its instructed to create via MQTT Discovery.

You may wish to contact OpenMQTTGateway’s author and ask for a feature that allows you to constrain what it requests to create via MQTT Discovery.

Hello David,

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.

Hi @1technophile, thanks for the awesome project!

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.

1 Like

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.

That is fair @123, what I first searched for was to delete the auto added entities:

…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.

I’m thinking of having the capability to remove the id into the unique id, this could be a way to limit the number of RTL_433 devices created.

This is where we build the unique_id for info:

Also I suppose that a white list of models could help

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.

Should be filtered as early as possible in the process I agree.

1 Like

@1technophile Will it merge all of the same types of sensors on the same channel if I remove the id?

I can try it out but it feels like it will break in other ways?

Yes it will merge the sensors with the same model/channel