Page 1 of 1

How to disable autoconnect ("no ap found, reconnect after 1s")?

Posted: Sun Feb 24, 2019 11:57 am
by eltomek
Even though my main.py and boot.py scripts do not contain WIFI connection calls (nor credentials), micropython seems to remember the credentials and keeps reconnecting every second, yielding a notification "no ap found, reconnect after 1s".
Also, despite providing new (incorrect credentials just for the sake of testing), the ESP8266 still uses the previous ones (the correct ones).
How can I disable it?

Re: How to disable autoconnect ("no ap found, reconnect after 1s")?

Posted: Sun Feb 24, 2019 4:49 pm
by kevinkk525
Just disable the wifi interface completely.

Re: How to disable autoconnect ("no ap found, reconnect after 1s")?

Posted: Mon Jan 06, 2020 5:48 pm
by jedie
Interesting... So it's **always** needed to add something like this in boot.py:

Code: Select all

network.WLAN(network.STA_IF).active(False)  # WiFi station interface
network.WLAN(network.AP_IF).active(False)  # access-point interface
Unless the device is always operated in the same wifi and that is always available.
So quite unlikely.

Re: How to disable autoconnect ("no ap found, reconnect after 1s")?

Posted: Mon Jan 06, 2020 6:04 pm
by jedie
Ah, ok. I first thought the device was stuck in a loop and boot.py/main.py was not called. But this is not the case.

I test it with this script:

Code: Select all

import machine
import network
import utime

if __name__ == '__main__':
    print('Set wrong WiFi settings...')

    sta_if = network.WLAN(network.STA_IF)
    sta_if.active(True)
    sta_if.connect('NotExisting SSID', 'No password')

    print('Hard-Reset...')
    utime.sleep(1)
    machine.reset()
So i get the connect message loop, but main.py is called and runs... So it's not needed to do anything. Great :P