Blueforcer / awtrix3

Custom firmware for the Ulanzi Smart Pixel clock or self made awtrix. Getting started is easy as 1-2-3
https://blueforcer.github.io/awtrix3/
Other
1.41k stars 112 forks source link

[BUG] Clock does not reconnect to Wi-Fi after it was disabled overnight #197

Closed dimw closed 1 year ago

dimw commented 1 year ago

Bug report

Describe the bug

My Wi-Fi - to which the clock is connected - is configured to turn off automatically during the night. Every morning, when the Wi-Fi is on again, the clock does not reconnect. However, it reconnects to Wi-Fi properly when the clock is turned off and on again. Disabling and enabling Wi-Fi again does not lead clock to reconnect.

This issue is not present when Wi-Fi disappears for a short time (several minutes). In this case the clock reconnects properly.

Additional information

To Reproduce

Steps to reproduce the behavior:

  1. Connect the clock to a Wi-Fi.
  2. Turn Wi-Fi off for ~6 hours.
  3. Turn Wi-Fi on.
  4. Issue: The clock does not reconnect to Wi-Fi.

Expected behavior

The clock reconnects to Wi-Fi shortly after the signal gets available again.

Logs

These are the logs I see in the morning on the clock while Wi-Fi is available for at least 2h already.

[124394730][E][WiFiClient.cpp:242] connect(): connect on fd 50, errno: 118, "Host is unreachable"
[124399729][E][WiFiClient.cpp:242] connect(): connect on fd 50, errno: 118, "Host is unreachable"
[124400127] [setCurrentApp]: Publish current app temp-outside-forecast
[124404252][E][vfs_api.cpp:105] open(): /littlefs/alarms.json does not exist, no permits for creation
[124404730][E][WiFiClient.cpp:242] connect(): connect on fd 50, errno: 118, "Host is unreachable"
[124409527] [setCurrentApp]: Publish current app precipitation-forecast
[124409729][E][WiFiClient.cpp:242] connect(): connect on fd 50, errno: 118, "Host is unreachable"
[124414252][E][vfs_api.cpp:105] open(): /littlefs/alarms.json does not exist, no permits for creation
[124414730][E][WiFiClient.cpp:242] connect(): connect on fd 50, errno: 118, "Host is unreachable"

Additional context

Kudos for the awesome project!

mslookup commented 1 year ago

I can confirm the bug, i have the same situation and my Ulanzi Pixel clock does also not reconnect automatically.

Blueforcer commented 1 year ago

Seems like a bug in the arduino framework. autoreconnect is enabled and worked for me. https://github.com/Blueforcer/awtrix-light/blob/a96ce12366584bc1b423093d2206654754052252/lib/webserver/esp-fs-webserver.cpp#L172

dont know what else to change..

jeffmando commented 1 year ago

I can also confirm the problem, is there perhaps a way to include a restart at a specific time or perhaps a function to restart the clock when the DNS is unreachable?

davlaw commented 1 year ago

Well, feeling kinda like what the heck?? Checked my wifi logs and showing over 35 hours on most 2.4 devices of connectivity and having both of my ulanzi devices fall offline again this morning, an experiment is in order!

Gonna fall back versions for a bit. Was at .70 falling back to version .69

Lets see?!?

Blueforcer commented 1 year ago

since the alpha version, there have been no changes to the wifi functions. So downgrade will not solve it, for sure

davlaw commented 1 year ago

Understand, and agree, but had to try something.

Just a note, clock visually appeared to be working normally, it was cycling thru it screens. What I noticed some values were not as I was expecting such as temp/humidity and weather.

Entities in Home Assistant were no long updated, shown "unavailable" , both clocks

Unable to log into clock web interface. Both clocks

Power off and back on restored operation on both clocks and their web interface and conx to HA

Interesting note, both fell offline at about 4am my time, odd. So I and looking at some outside influence something on my network.

What effect does mqtt or loss of connection to the mqtt server have if any?

cebrac commented 1 year ago

Can confirm that this occasionally happens to my clock (0.70) even when WiFi doesn't turn off (maybe just drops out for a second?)

Blueforcer commented 1 year ago

Some users reports that they have problems with some Ubiquiti routers. They had to disable some optimizing features and/or select a static wifi channel. https://discord.com/channels/546407049148366859/1124762310133698713

mslookup commented 1 year ago

Interesting! I have indeed Ubiquiti UniFi WiFi APs in place. Will try it out!

cebrac commented 1 year ago

If anybody could please copy the info for non Discord users, that'd be much appreciated <3

davlaw commented 1 year ago

Asus RT-AX58U/merlin here. I have fallen back to .69 for now with some device monitoring on the 2 ulanzi devices.

I did catch and disable Roaming assistant, it can disconnect when below certain signal strength, I split the 2.4 and 5 bands too. Did this sometime ago, could see this causing all kind of problems with devices getting all whacked out getting random disconnects and such. Did not see much value in that option.

Blueforcer commented 1 year ago

If anybody could please copy the info for non Discord users, that'd be much appreciated <3

"Also i disabled nightly channel optimization on my unifi controller"

"I'm finding little hints in a google search that some ESP32s have problems on wifi channel 11 -- people posting logs that say channel 11 then that they changed their channel to auto and the problem resolved itself"

davlaw commented 1 year ago

I know, you said it would not make any difference, but I tried, .69 would not reconnect after a ~ 1 hour power failure this morning.

Battery stayed up tho!

Blueforcer commented 1 year ago

any news here?

mslookup commented 1 year ago

With disabling overnight WiFi channel optimization in UniFi Controller, I got an uptime of ~2 weeks. For me, it’s not a problem any more. After firmware updating the UniFi APs, it still needs a reboot by me, but thats a point I am fine with.

cebrac commented 1 year ago

Same here. Shame I had to disable that feature but if it's an issue with the ESP32 and not the specific firmware, understandable that it can't be fixed.

Stable uptimes now without that channel change feature.

Blueforcer commented 1 year ago

Sorry

zanaca commented 1 year ago

Hi guys!

I had the same problem here and I do not have any UniFi Controller. I have and old router (2.4ghz only) running OpenWrt. I had to turn off the router for a while and then I have noticed the TC001 was not connected to the wifi. Had to restart it.

hardoverflow commented 1 year ago

I can confirm that two installations of the clock have from time to time the same disconnection issues as discribed here. Only a reboot helps. But sometimes, i need to reboot twice. And yes, all the clocks depends in UniFi APs.

quantum-fc101 commented 6 months ago

Same issues here using Ruckus Unleashed AP's clock disconnects after awhile. Clock is connected to an IOT VLAN with 2.4G only and Background Scanning is switched off.