ESP32 BLE gateway dying every X days

I have a ESP32 board with capabilities [“RF”,“BT”,“HCSR501”,“DHT”], it dies every few days/hours. To let it restart I connect 5v to the “EN” pin.

I wonder is this normal?

Here are the history snapshots of uptime&free memory in HA


Thanks for the chart, it is interesting.
I have also my esp32 gateways that restart automatically sometimes but I’m not seeing these memories jump, are you using the default parameters for BLE scanning, is there any particular configuration changes that you could share?

Here are the changes I made for the BT configuration(the reason why is I want the BT gateway to read the status change of my door sensor more frequently so it wouldn’t miss any door open event)

#  define ScanBeforeConnect 80
#  define TimeBtwRead 7000

you can see the whole diff here:esp32 1st config based on 0.9.8 · lkisme/OpenMQTTGateway@dbd57dc · GitHub

it’s based on the “0.9.8” tag

FYI,there are only 2 ble devices I need to track, so I send the white list command per day to the gateway.

You could publish the white list with the retain flag. It will be recorded this way by the broker. And you will not have to send it everyday.
https://docs.openmqttgateway.com/use/ble.html#setting-a-white-or-black-list

Thanks for the tip, for some reason, I didn’t use the retain flag.

Do you have any idea why the “free memory” jump ?

BTW, my other nodemcu board dies and would’t restart sometimes(in this case, if I pushed the RST button on the board, the Serial would print “{null} {null}”. After several times pushing, the board will restart successfully), is there some solution to make sure it will restart(like I did with the ESP32 by connecting the EN to the VCC)?

I don’t have these with my devices. I will try to reproduce your exact configuration to verify if I get the same behaviour.

Could you give the exact model ?

Hi, after some work, I found out 2 kinds of scenarios the OMG would crash, both of them are related with the MQTT connection.

This topic is so long that I create a new one: Runtime exceptions(would cause restart) with OMG

1 Like