How to filter unwanted MQTT payloads?

Hello,

Recently I installed OMG 1.6.0 onto a ESP32-WROOM board (binary : “esp32dev-ble”).

When I have a look into MQTT Explorer, I notice that I have a huge list of discovered devices with this kind of payload : {“id”:“…”,“rssi”:-xx}. This list grows over the time. It seems that all these devices are in fact only one device, a LOGITECH SMART RADIO.

When I switch off the radio ans start MQTT Explorer, the topics are as follows :

When I switch on the radio and after a few hours, the topics are as follows :

My question is : how can I avoid to send these unwanted payloads to my MQTT broker ? It should be noted that “randommacs” OMG parameter is set to “false”.

Hi @Mific

You might want to turn on Advanced and Advertising Data, to show more data on what these additional devices might be, BUT the best solution and general practice is to apply a white-list to your gateway, so that only ever your desired devices are being recognised, decoded and published to MQTT.

Also have a look at publishing only sensors.

Hope this helps

Hi @DigiH,

I used the white & black list feature and I have a few questions.

1/ I have the feeling that as long as there is at least one MAC address in the white list then all the other MAC addresses are automatically black listed. Is it correct ?

2/ I used the MQTT “retained” option so that the white list is not lost when the gateway is turned off. It’s OK but it took me a while to understand that only the last topic was “retained” (that’s the normal behaviour of an MQTT broker : only one message is retained per topic). So e.g. if I send a “white-list” command (topic “config”) and then after a “minrssi” command (topic “config”) then my white list will not be sent back to the gateway by the broker when the gateway will be switch on again… Is there another way to make the white list persistent ?

Hi @Mific

Well, this is sort of the meaning of a white-list, that only the MAC address(es) in the white-list are being recognised, so yes, all other MAC addresses are then basically blocked/black-listed.

The “minrssi” setting is actually a setting which is stored on the actual ESP32, and with a "save":true addition will also be saved on the ESP32 over restarts. This means it never has to be sent with any retain flag and therefore then does not overwrite any previously sent retained white-list.

All available BTtoMQTT settings are like that, and only the white-list command needs to be retained on the broker for being resent after gateway restarts.

Hope this helps.

Thanks a lot @DigiH ! Everything is perfectly clear now.