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

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
eltomek
Posts: 12
Joined: Sat Feb 02, 2019 8:32 am

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

Post by eltomek » Sun Feb 24, 2019 11:57 am

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?

kevinkk525
Posts: 601
Joined: Sat Feb 03, 2018 7:02 pm

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

Post by kevinkk525 » Sun Feb 24, 2019 4:49 pm

Just disable the wifi interface completely.
Kevin Köck
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode

jedie
Posts: 245
Joined: Fri Jan 29, 2016 12:32 pm
Contact:

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

Post by jedie » Mon Jan 06, 2020 5:48 pm

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.

jedie
Posts: 245
Joined: Fri Jan 29, 2016 12:32 pm
Contact:

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

Post by jedie » Mon Jan 06, 2020 6:04 pm

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

Post Reply