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?
How to disable autoconnect ("no ap found, reconnect after 1s")?
-
- Posts: 969
- Joined: Sat Feb 03, 2018 7:02 pm
Re: How to disable autoconnect ("no ap found, reconnect after 1s")?
Just disable the wifi interface completely.
Kevin Köck
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode
Re: How to disable autoconnect ("no ap found, reconnect after 1s")?
Interesting... So it's **always** needed to add something like this in boot.py:
Unless the device is always operated in the same wifi and that is always available.
So quite unlikely.
Code: Select all
network.WLAN(network.STA_IF).active(False) # WiFi station interface
network.WLAN(network.AP_IF).active(False) # access-point interface
So quite unlikely.
Re: How to disable autoconnect ("no ap found, reconnect after 1s")?
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:
So i get the connect message loop, but main.py is called and runs... So it's not needed to do anything. Great
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()