MQTT Discovery only discovers what is submitted for discovery.
Your ESP device finds all 433MHz devices in your neighborhood and submits them to Home Assistant via MQTT Discovery.
It isn’t MQTT Discovery’s responsibility to filter out discovery requests. The responsibility lies with whatever makes the request.
If you have no control over what the ESP device submits to Home Assistant via MQTT Discovery, then that’s a shortcoming with its functionality (not with MQTT Discovery).
Here’s one way to filter submissions from the ESP device:
By default, the MQTT Discovery topic begins with homeassistant
. If possible, reprogram the ESP device to publish to an MQTT Discovery topic beginning with temp
or discovery433
or another word of your choosing.
Create an automation that listens for anything published to the temp
topic and then re-publishes it, in its entirety, to the homeassistant
topic but only for the 433MHz devices you want. In other words, the automation contains a “white list” of desired 433MHz devices and doesn’t re-publish devices that’s aren’t in the list.
The automation will only allow Home Assistant to discover the specific devices you want (and ignore your neighbor’s devices). Let me know if you need help creating it.
EDIT
Here’s an example of the automation I described. It assumes the ESP device has been reprogrammed to publish MQTT Discovery messages to a topic beginning with discovery433
instead of the default homeassistant
.
If a discovery topic looks likes this:
discovery433/sensor/wxyz4567/config
and it represents a sensor
you want to have created in Home Assistant, then you should add wxyz4567
to the whitelist
variable (see below).
alias: 433MHz Discovery Filter
trigger:
- platform: mqtt
topic: discovery433/#
condition:
- condition: template
value_template: "{{ trigger.topic.split('/')[2] in whitelist }}"
action:
- service: mqtt.publish
data:
topic_template: "{{ trigger.topic.replace('discovery433', 'homeassistant') }}"
payload_template: '{{ trigger.payload_json }}'
retain: true
variables:
whitelist:
- abcd1234
- wxyz4567
- qrst8888
- mnop4444