Any way to exclude devices that are autodiscovered by MQTT

I run HA in 2 homes connected by a permanent VPN. The 2 instances are completely separate. My MQTT brokers are bridged for other purposes. When I set up MQTT for autodiscovery, my local instance also autodiscovers things in the remote home (not surprising) and I’d like to be able to exclude those from the local HA instance. Is there any way to do such an exclude? Should there be, or am I thinking about the problem the wrong way? I’ve looked at previous posts with similar issues but most seem related to issues with MQTT retain which is not my problem.

MQTT Discovery offers an option called discovery_prefix. The default is homeassistant.

I imagine both of your instances use the same default value of discovery_prefix so they are free to discover each other’s devices.

Set the remote instance to use something different such as homeassistant2. The second step is to set all discoverable devices at the remote location to publish their discovery topic to homeassistant2 instead of homeassistant. In this way, neither of the two instances discovers the other one’s devices.

1 Like