ESP32 doesn't stay online

To check that I manually restartet my mqtt broker.
This isn’t the issue here, because the omg goes back/stays online after the restart.

It looks like if it loses the wifi connection somehow (eg router restart) it isn’t able to connect to wifi again.
This is repeatable, restarting my router means that the omg goes offline and stays offline.

I have just retested v0.9.2 on an esp32 with the following env:

[env:esp32dev-ble]
platform = ${com.esp32_platform}
board = esp32dev
board_build.partitions = min_spiffs.csv
lib_deps =
  ${com-esp.lib_deps}
  ${libraries.ble}
build_flags = 
  ${com-esp.build_flags}
  '-DZgatewayBT="BT"'
  '-DGateway_Name="OpenMQTTGateway_ESP32_BLE"'

With the following steps:

  • deactivate wifi
  • reactivate after 5s

OMG reconnects automaticaly

  • deactivate wifi
  • reactivate after 1min

OMG reconnects automaticaly

I pulled the latest dev version and was able to flash directly in vsc over the usb port (did it with FTDI before).

Unfortunately I still have the same issue. If the wifi routers restarts or fails the ESP32 OMG isn’t able to reconnect (again no problem with the ESP8266 running current master). I flashed:

default_envs = esp32dev-rf

And with the same env than me do you get the same behaviour ?

Flashed the same env as you and also removed my attached modules (RF and a LED).
Erased the flash before, just to make sure it’s a clean flash.

So now it’s a “naked” ESP32 with

default_envs = esp32dev-ble

and still after a reboot of my router the ESP32 goes and stays offline.

EDIT: it went online again after a minute.
EDIT2: unfortunately only for a few seconds and than went offline again.
EDIT3: I testet fresh ESP32 board, with the same result. So the first one isn’t defective.

Looks like I’m not the only one with this problem (ESP32):

Yep, I saw that. I will try a router restart instead of a wifi restart, if I don’t reproduce the difference could be due to the board or the router network. But as @PetricaM gets also bad result I’m excluding for the moment the network.

@PetricaM could you try to restart your router to see if your esp32 does the same like mine (staying offline).

Yeap, I already tried it but the behavior is too erratic.

Sometimes ESP32 reconnects, sometimes it doesn’t.

When it doesn’t reconnect I can see (in some of the cases) that the router has fast (2-3 per second) associate and disassociate events in the log. Some other times there’s dead radio silence from the board.

And when the ESP32 is not connected anymore does it popups the web portal for wifi configuration?

Nope (actually, I haven’t used wifi manager :slight_smile: )

Are you using wifi manager or the manual method?

I’have done the test with wifimanager. Maybe we have the point.
Could you try with it please?

Will be able to do it; however, only during weekend

No problem, thanks Petrica

You’re welcome!

Actually, I don’t have anything near this one :smile: Lock, Stock and two smoking barrels - Fertilizer scene - YouTube

I use the Wifi manager, so configurator which pops up when you open the the OMG SSID.

And does it pop up once disconnected from the router ?

No, it keeps the WiFi data, so it doesn’t build that OMG AP again.

But it (the esp32) connects again after restarting it (power off/on). So same behavior like @PetricaM mentioned. His solution was to add a powerplug which restart the OMG device if the LWT Signal goes offline. Which of course is a nice workaround, but I would prefer a device that is able to reconnect on its own.

Could you post the serial monitor logs please when you do a router restart ?