Do not delete whitelist after reboot

Hello,
I have the problem that the white list is deleted on restart.
I live here in a big street and OMG finds about 300 new devices per hour.
I may have 5000 devices in IoBroker in one day, which slows down iobroker a lot.
When iobroker is slowed down, it takes a long time to delete the unwanted devices.

Can you kindly create a way that the white list is not deleted after a reset or power failure?

Hi Muchul,

Have you read the tip about keeping the white list persistent with the retain option in the docs?

https://docs.openmqttgateway.com/use/ble.html#setting-a-white-or-black-list

While I’m using openHAB and not IoBroker, I’m sure it’s also possible to additionally send the white list from there again if and when the LWT topic changes from offline to online, i.e. after a reset.

Hope this helps.

Hi DigiH,

yes, I have taken that into account.
I think currently it is desired that the whitelist is deleted on restart.
That is why I made the request.

Correct, this is currently the only way to currently clear any applied white/black list.

But if you have sent the white list with the retain option, your MQTT broker will send it again to reapply it after a restart of your OMG. Just make sure you send your white list with the RETAIN option.

Since I require different white lists in my setup, depending on various other conditions, I programmatically restart OMG, then catch the LWT topic and reapply a different white list depending on the circumstances.

So two possibilities to make sure your white list is always being applied.

If you searched through the forum, you might have seen how I came to the above solution, when I asked about the possibility of reducing or clearing a white list :wink:

Thanks, I found the solution, but unfortunately this is not an option for me.
I am a dumb user who can not program.
Therefore, until now I have always uploaded the whitelist manually, I don’t know anything about scripts.
Currently I have turned off the OMG s, because they disturb more than they help.
I’m looking for another solution, or until there is an update.

How did you upload the white list manually in the first place? Very likely through the available MQTT command as described in

So just do the very same command, BUT with the additional RETAIN flag -r, as described in the Tip.

No programming required for that, and it’ll do what you want, reapply your white list after a reset of OMG.

Hello DigiH,

I have uploaded it with MQTT Exolorer::

this also works until the ESP32 is restarted.

Also a possibility, and in the bottom right corner you see the option for making this command being retained by your MQTT broker. It looks ticked, but also somehow greyed out?!? What happens if you toggle this checkbox? Also what about setting the format to send as ‘json’ instead of ‘raw’.

Once the white list is sent correctly with that RETAIN option your broker will resend the white list to OMG again, even after a restart of OMG.

If you subscribe to your MQTT broker with MQTT Exolorer it shoudl also show you if the white list command is correctly retained.

Also you have a “,” at the end of the last mac address that shouldn’t be there

I have corrected the above errors and am currently testing

First I have a question please, when I send the whitelist via MQTT, what is correct?
home/BLE_AZ/commands/MQTTtoBT/config
or
home/BLE_AZ/commands/MQTTtoBT/config -m

This is with mqtt explorer

This is with mosquitto

I think it works now,
I see this message for the first time in the LOG file:

mqtt.0
2021-08-14 14:42:23.813 debug stateChange mqtt.0.home.BLE_AZ.commands.MQTTtoBT.config: {“val”:"{“white-list”:[“DD:49:8F:E7:1F:99”,“F3:32:E9:68:D0:B6”,“E0:4C:3B:E8:E7:49”]}",“ack”:true,“ts”:1628944943810,“q”:0,“from”:“system.adapter.mqtt.0”,“user”:“system.user.admin”,“lc”:1628943549820}

1 Like

OK, I am one step further:
home/BLE_AZ/commands/MQTTtoBT/config
helps already that the whitelist is sent.
But:

I have disconnected the ESP32 several times now (about 15 times).
Most of the time it worked, but then again it didn’t.

what surprises me:

When I disconnect the ESP32, the whitelist is NOT sent, I see the send in the LOG only when I start it via the MQTT Explorer.

Could it be the IoBroker MQTT adapter?
You said the broker (IoBroker) should send the whitelist when reconnecting, right?

If you close mqtt explorer and open it, do you sez the white list ?
If yes, this means that the white list is correctly persisted at the broker level.

Yes, I see the list.
I just do not see that it is also sent.
However, I have now disconnected and connected the ESP32 another 20 times, so far it still works.
I have now brought it to its place and put it into operation.
Now it’s the turn of the other three.

One question, does it make a difference if I de-energize the ESp or press the reset button?

If you cut power off or soft reset the esp you will keep your wifi and mqtt parameters (they are stored in flash) and the white list will still be read at restart due to its retain status on the broker.
Retain flag enables to record the message on the broker.

So both do the same thing…

Thank you for the information.

I have never tested IObroker, would you be interested in writing a tutorial with Openmqttgateway ? We could even include it in the docs.

I can try, however I do not speak English, what I write is translated from deepl.
I could create the images and write everything in German and then ask in the Iobroker forum if someone would help.