ESP32 doesn't stay online

I’ll give that another try. I did not watch it on the serial monitor the last times, because I tried another power supply (not my laptop).

Now back again on wifi manager (because made no difference) and and still on the newest version.

This is the output after connection is lost due to a router restart:

MQTT connection...
[E][WiFiClient.cpp:365] write(): fail on fd 57, errno: 113, "Software caused connection abort"
failure_number
1
failed, rc=
-4
try again in 5s
MQTT connection...

looks like it is stuck again after that first try, because even after minutes it doesn’t go to the second try.

I remember that I had a similiar issue with the ESP8266 when I did not use spiffs. But in this case it did not save the wifi settings.

Little differnt here because the restart of the ESP32 makes it work again, so the wifi settings are there.

Seems that the wifi state returned by the wifi library doesn’t correspond to the real state:

It returns connected but we are not .

If you wait at least 5 minutes after this

The board should reset itself, could you try?

One test also that can be done is to attribute a fix IP adress to your ESP32 and see if you get the same behaviour.

I noticed something new. After the last wifi router restart it seems like the esp32 went online for some seconds just to go offline again. No ping.

After that I waited for more than 5 minutes and the board did not reset.
So

  • no things going on in the serial monitor-
  • no reconnecting to the broker (I watch it with MQTT Explorer)
  • no omg wifi manger

Nothing.

I have another router. I build a second wifi network to try if it’s something in my network. I will also try the fixed IP.

Quick update:

I opened another network and connected to this one. I turned off WiFi on that router and turned it on again.
This time I got some messages about WiFi connection loss (did see this the first time). And after turning WIFI on again the esp32 went online immediately.

Any suggestions why it works with on WiFi and not with the other one.
I don’t have any other issues with that first network.
However 5Ghz was deactivated on the new router.

I’m out of time for today and will test again tomorrow. Any suggestions appreciated.

I think we need to details both router model/configuration and enrich the issue below:

As it is on wifi basement we should try first to solve it at this level.

It‘s a Apple Timecapsule. Like most of the times with Apple not much to configure. And as I said no issues with other devices.

I have 2 additional Apple Express which extend the network.

What specific configuration details should I look up?

Will try the fixed IP soon.

Currently I have the esp32 on the new network to see if it stays online.

Ok, so the ESP32 is able to stay online on that second new network.

However there are still some interrupts detected by home assistant. Is this normal?

LWT value:

Wasn’t able to set up a fixed IP. Seem like I would have to turn off DHCP on my router (but this would opnen up other issues, with other devices).

See the first line here:

// these values are only used if no dhcp configuration is available

const byte ip[] = { 192, 168, 0, 70 }; //ip adress

const byte gateway[] = { 192, 168, 0, 1 }; //ip adress, if first value is different from 0 advanced config network will be used and you should fill gateway & dns

const byte Dns[] = { 8, 8, 8, 8 }; //ip adress, if first value is different from 0 advanced config network will be used and you should fill gateway & dns

const byte subnet[] = { 255, 255, 255, 0 }; //ip adress

Normal I would not say that, but it is equivalent to what I got in my side. I think it is acceptable.
Is the esp32 far from your router?
image

You don’t have the possibility at router level to attribute a static IP corresponding to the MAC adress ?

On my router it is possible without any change on user_config.h for info.

Not very far but some walls between. The thing is that was just a test wifi network and yes I get the same behaviour like you. So it is able to reconnect with that network. But as it is only a test network I won’t keep that one.
This tells us the esp32 is flashed correctly and it is not defective.

I still think it’s some software issue on the esp32, because as I said no other devices have issues (and other esp’s work fine, tasmota devices).

ah you mean a dhcp address reservation, right? Yes, I had that from the beginning. I was once told that a dhcp address reservation is not a real static IP, which is why I missunderstood you.

Unfortunately no change with a fixed IP (address reservation).

When you are saying other software works fine. Are they on an esp32 also ?

No, I mean all other wifi devices in my network work fine. But I don’t think any of them are ESP32. Mostly ESP8266 devices.

In this case could you give me the exact model of your router (if there is more to say) and I will reopen the issue on the esp32 arduino env.

It’s an Apple Timecapsule 5.gen A1470. Firmware 7.9.1 (so current version)

Thanks!

The new version v0.9.2 is now online on two of my ESP32 since one month, here is the outdoor temperature graph from a mi flora:

image

So as we discussed before it must be something in my network.

Currently I don’t have the ESP32 in my network. But as it is still 0.92 I don’t think more tests will help, as I already tested this version some weeks ago.

Yep, I have added your config to the issue in github of arduino esp32:

But this doesn’t seem to draw the crowds.

1 Like

Just here to add that I changed my network to Unifi. So no Apple Routers and Access Points in my house any more.

So from my side we will probably never find out what was the issue here, because I won’t set it up as router again (was time consuming to change it).

Now it seems like the OMG devices work fine with Unifi. I didn’t reflash the OMG.