Github Upload Boards Devices Community Docs Blog

Question: MQTT topic remove id

How can I remove the ID from MQTT topics ?

ble/OpenMQTTGateway_ESP32_BLE/BTtoMQTT/4A5CD90A0131
“{“id”:“4A:5C:D9:0A:01:31”,“rssi”:-88,“txpower”:24}”

The random addresses from some devices (4A5CD90A0131) are killing my db.

similar to

But I would like to remove that or customize the entire mqtt topic in OMG itself

hmm from what I can tell this is hardcoded in OMG actually, it would be nice if this was tokenized in mqtt topic etc.

void pubBTMainCore(JsonObject& data, bool haPresenceEnabled = true) {
  if (abs((int)data["rssi"] | 0) < minRssi && data.containsKey("id")) {
    String mac_address = data["id"].as<const char*>();
    mac_address.replace(":", "");
    String mactopic = subjectBTtoMQTT + String("/") + mac_address;
    pub((char*)mactopic.c_str(), data);

You could use a white list to avoid unnecessary devices being sent

I may be able also to identify this kind of random addresses so as to apply a filter

I am gonna try to fix it in telegraf, using topic_tag=“” and at least avoid the topic tags

Ill check into that type thing, interesting.