I have a Heltec LoRa board that I’m using as a RF gateway. (I live in the US and bought the 433Mhz version of the Heltec Lora device by mistake. I was thrilled when I realized I could use it as a RF gateway for 433Mhz devices by flashing it with OMG.) My problem is that (as I understand things), with the binary versions of OMG, it’s not possible to fully disable auto discovery. Instead, the device goes into discovery mode for 30 minutes every time it’s turned on or rebooted. This means that if I leave MQTT auto-discovery enabled in Home Assistant, I eventually get 300+ random MQTT devices, most of which are owned by my neighbors, not me.
This is not good for a few reasons. First, it increases the size of my Home Assistant database with unnecessary data. Second, it makes it harder to maintain. Third, if I disable auto-discovery for MQTT, it will screw up other integrations that use MQTT auto-discovery. And fourth, having all these random devices causes the automation I have to send me a notification when any battery-powered device has a low battery is firing at least once a day to warn me about some random device that isn’t even mine.
I know I can disable auto-discovery in Home Assistant and manually create entities for the few devices I have. The problem with this is (as far as I can tell), it’s not possible to associate manually-defined MQTT entities with a device. So I don’t get a nice screen where (for example), I can see my Acurite freezer sensor’s RSSI, battery level, and temperature on one screen.
I came up with what I thought would be a clever solution. I’ll configure OpenMQTTGateway to publish it’s MQTT auto-discovery messages to some non-standard prefix and I’ll create a Home Assistant automation that runs automatically every time Home Assistant is started that publishes the MQTT auto-discovery messages for the devices I do want to appear in Home Assistant. This will be very easy to do, because I can monitor my MQTT server (using a program like MQTT Explorer, https://mqtt-explorer.com/) to look at the auto-discovery messages published by OMG to the non-standard prefix and just copy the ones I want into my automation.
The problem with my idea is that the Home Assistant auto-discover prefix (“homeassistant/”) is hardcoded in OpenMQTT. See OpenMQTTGateway/main/config_mqttDiscovery.h at ef07a339ab57d129316e30bbe4851ea1d998ec17 · 1technophile/OpenMQTTGateway · GitHub
So my request is this: Instead of hard-coding the Home Assistant auto-discovery prefix, make it a variable that can be easily changed via the “Configure MQTT” screen in the OpenMQTTGateway web GUI for ESP32 devices. I suggest the variable name be “Home Assistant Auto-Discovery Prefix”.
If there’s some other way to filter which RF devices OpenMQTTGateway publishes to the Home Assistant auto-discovery MQTT prefix, please share.