hvxl / otgwmcu

Firmware for the NodeMCU of the Nodo Shop WiFi version of the OTGW.
MIT License
7 stars 2 forks source link

OTGWMCU doesn't reconnect to Wi-Fi #3

Open mihsu81 opened 1 year ago

mihsu81 commented 1 year ago

Hello @hvxl,

OTGWMCU doesn't reconnect to Wi-Fi if I reboot the router. I either have to connect to its AP and restart it or power cycle it.

Would it be possible to either make it reconnect to Wi-Fi after a reboot? If this is by design, could you add an option to select the behaviour?

Thank you in advance.

hvxl commented 1 year ago

I expect otgwmcu to reconnect to WiFi as well. To check this, I set up a WiFi test network, configured this network on the otgwmcu and my phone, and accessed the otgwmcu from my phone to make sure it works.

Then I shut down the WiFi test network and waited 5 minutes. The otgwmcu did not go into AP mode (no OTGW-MCU WiFi network appeared). And when I started the WiFi test network again, the otgwmcu reconnected with it and I could access it again from my phone.

So, as far as I can tell, it works as we both expected, and not as you described.

Of course, if you have a power outage, and both your router and the otgwmcu reboot after the power comes back, the otgwmcu is likely to recover much faster than the router. In that case it won't find the configured WiFi network and go into AP mode. But that's a very different scenario.

mihsu81 commented 1 year ago

I've rebooted again the router, after about 2 days and the otgwmcu did reconnect automatically. In the previous case which I've mentioned in my first post, the WiFi router was on for a couple of weeks. There hasn't been any power failures during this time.

I'll try again in a week to reboot the router and see if the otgwmcu reconnects or goes on AP mode.

Are there any logs I can collect from the otgwmcu?

Thank you.

mihsu81 commented 1 year ago

Looks like the issue appears when I reboot Home assistant which is the DNS server and NTP server and it's unavailable for a period of time The main problem here is that the nodemcu never tries to reconnect. I think that nodemcu trying to reconnect periodically would be a good addition to the code. All my other ESPHome, Tasmota or Shelly devices reconnect just fine.

mihsu81 commented 1 year ago

I'm coming back with more insight intro the issue. Apparently it also doesn't like to be roamed between nodes by the Asus AiMesh. And binding it to only 1 node stops it from connecting altogether. For now I've moved to https://github.com/rvdbreemen/OTGW-firmware which copes well with the Asus AiMesh.