ESP32 doesn't stay online

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: https://www.youtube.com/watch?v=lb7Vh37bSqE

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 ?

Pulled the current dev version and tried what you say. I acts really strange.
It was able to reconnect at the first try. You will see that in the logs. But it got stuck at last try (last line in the logs). It’s like it hang up, no more serial outputs.

Scrachted out sensible data:

MQTT connection...
Connected to broker
Subscription OK to the subjects
Uptime (s)
240
omgStatusDiscovery
Pub json into:
homeassistant/binary_sensor/CC*****24/config
{"stat_t":"home/OpenMQTTGateway_ESP32_RF/LWT","name":"OpenMQTTGateway_ESP32_RF","uniq_id":"CC*****24","dev_cla":"connectivity","pl_on":"online","pl_off":"offline","pl_avail":"online","pl_not_avail":"offline","device":{"name":"OpenMQTTGateway_ESP32_RF","manufacturer":"OMG_community","sw_version":"0.9.2","identifiers":["CC*****24"]}}
Pub data per topic
stat_t
home/OpenMQTTGateway_ESP32_RF/LWT
name
OpenMQTTGateway_ESP32_RF
uniq_id
CC*****24
dev_cla
connectivity
pl_on
online
pl_off
offline
pl_avail
online
pl_not_avail
offline
gatewayRFDiscovery
CreateDiscoverySensor
gatewayRF
Pub json into:
homeassistant/sensor/CC*****24gatewayRF/config
{"stat_t":"home/OpenMQTTGateway_ESP32_RF/433toMQTT","name":"gatewayRF","uniq_id":"CC*****24gatewayRF","val_tpl":"{{ value_json.value }}","device":{"name":"OpenMQTTGateway_ESP32_RF","manufacturer":"OMG_community","sw_version":"0.9.2","identifiers":["CC*****24"]}}
Pub data per topic
stat_t
home/OpenMQTTGateway_ESP32_RF/433toMQTT
name
gatewayRF
uniq_id
CC*****24gatewayRF
val_tpl
{{ value_json.value }}
{"uptime":240,"freeMem":255184,"rssi":-54,"SSID":"**myssid**","ip":"192.168.0.125","mac":"CC:*****:24","modules":"RFHADiscovery"}
client disconnected
wifi disconnected
client disconnected
wifi disconnected
client disconnected
wifi disconnected
client disconnected
wifi disconnected
client disconnected
wifi disconnected
client disconnected
wifi disconnected
client disconnected
wifi disconnected
client disconnected
wifi disconnected
client disconnected
wifi disconnected
client disconnected
wifi disconnected
client disconnected
wifi disconnected
client disconnected
wifi disconnected
client disconnected
wifi disconnected
client disconnected
wifi disconnected
client disconnected
MQTT connection...
Connected to broker
Subscription OK to the subjects
Uptime (s)
361
omgStatusDiscovery
Pub json into:
homeassistant/binary_sensor/CC*****24/config
{"stat_t":"home/OpenMQTTGateway_ESP32_RF/LWT","name":"OpenMQTTGateway_ESP32_RF","uniq_id":"CC*****24","dev_cla":"connectivity","pl_on":"online","pl_off":"offline","pl_avail":"online","pl_not_avail":"offline","device":{"name":"OpenMQTTGateway_ESP32_RF","manufacturer":"OMG_community","sw_version":"0.9.2","identifiers":["CC*****24"]}}
Pub data per topic
stat_t
home/OpenMQTTGateway_ESP32_RF/LWT
name
OpenMQTTGateway_ESP32_RF
uniq_id
CC*****24
dev_cla
connectivity
pl_on
online
pl_off
offline
pl_avail
online
pl_not_avail
offline
gatewayRFDiscovery
CreateDiscoverySensor
gatewayRF
Pub json into:
homeassistant/sensor/CC*****24gatewayRF/config
{"stat_t":"home/OpenMQTTGateway_ESP32_RF/433toMQTT","name":"gatewayRF","uniq_id":"CC*****24gatewayRF","val_tpl":"{{ value_json.value }}","device":{"name":"OpenMQTTGateway_ESP32_RF","manufacturer":"OMG_community","sw_version":"0.9.2","identifiers":["CC*****24"]}}
Pub data per topic
stat_t
home/OpenMQTTGateway_ESP32_RF/433toMQTT
name
gatewayRF
uniq_id
CC*****24gatewayRF
val_tpl
{{ value_json.value }}
{"uptime":361,"freeMem":251688,"rssi":-89,"SSID":"**myssid**","ip":"192.168.0.125","mac":"CC:*****:24","modules":"RFHADiscovery"}
client disconnected
MQTT connection...

Thanks for the info I will investigate.

Hi Florian,

I flashed with the current dev sketch with wifi manager enabled. It works fine for a while, however, although it doesn’t disconnect from wifi anymore, there’s only the heartbeat payload at each 2 minutes:

{“uptime”:10560,“freeMem”:51124,“rssi”:-61,“SSID”:“Home”,“ip”:“192.168.0.221”,“mac”:“23:14:A4:31:B6:58”,“modules”:“BT”}

After manual reboot it sends decoded BT messages again for some time.

Hi Petrica,

I’m able to reproduce this behaviour, now I have to find where the issue comes from…

After a code modification I’m at 24H without BLE lost…

Let’s see

Around one week of correct working with:

  • 2 brokers stops due to raspberry pi failure :frowning: (disconnected during several hours, one between tuesday and wednesday and the other this night)
  • 1 provocated router restart (6 minutes wait time)

image

The interval is the default one (55555ms).

The gateway was neither restarted nor reseted during this period. It reconnected itself each time.

Here is the branch corresponding to the tested code:

If you would like, you can test it and see if you get better stability

Hi again,

I erased the flash storage and flashed the new version you provided. Unfortunately again after a router restart it doesn’t go online again :confused:. Still no problems like that with the NodeMcu ESP8266.

You restart the broker after how much time or how much does the router stays OFF?

I don’t restart the Broker. The Broker runs on a separate Pi. And if I restart that one there are no issues.

When I restart my WiFi router I get Thor issues. You ask how long. Well there is a button in the router UI which says restart.
Alls other devices reconnect without issues.

Only the OMG32 doesn’t reconnect. As I said it looks like it gets stuck in a process. Needs to be unplugged.

Edit: When I say it doesn’t reconnect I mean it doesn’t reconnect to wifi. So it has no chance to reconnect to the broker. No ping to the ip address.

Sorry I meant router and not broker …
Does the gateway IP adress attributed by DHCP or is it a fix IP adress?

DHCP.

In the meantime I tried setting up wifi settings without wifimanager. So directly in the code before flashing.
No change, it still doesn’t reconnect.

And it is still blocked with this message on the serial monitor?