connecting to open wifi access point?
connecting to open wifi access point?
I can connect to access points that have passwords with no problem;
wlan.connect('theSSID', 'password')
However when I try this on an access point that doesn't have a password it doesn't ever seem to be connecting. As in wlan.isconnected() is always false. I am trying it with password as an empty string. Maybe that's not the right thing to do?
wlan.connect('theSSID', '')
wlan.connect('theSSID', 'password')
However when I try this on an access point that doesn't have a password it doesn't ever seem to be connecting. As in wlan.isconnected() is always false. I am trying it with password as an empty string. Maybe that's not the right thing to do?
wlan.connect('theSSID', '')
Re: connecting to open wifi access point?
Did you try without any password.
Re: connecting to open wifi access point?
I've tried it with no password argument and it appears to loop inside the method and continuously trying to connect. With a blank password it does return, but remains in the 'connecting' state indefinitely.
Re: connecting to open wifi access point?
I did have a look at the sources (esp8266/modnetwork.c) and do not see any possible reason for that behavior. In both cases an empty string is passed to the underlying SDK method (wifi_station_set_config).
A quick online search did yield some issues with the ESP SDK toolchain wich has had such issues with empty passwords. What are the surrounding parameters like the wireless security parameters?
A quick online search did yield some issues with the ESP SDK toolchain wich has had such issues with empty passwords. What are the surrounding parameters like the wireless security parameters?
Re: connecting to open wifi access point?
Thanks very much for looking. I'm just using the example code shown here with whatever parameters are the default;
https://docs.micropython.org/en/latest/ ... asics.html
Any suggestions as to different parameters to try?
>>> import network
>>> wlan = network.WLAN(network.STA_IF)
>>> wlan.active(True)
>>> wlan.scan()
... using the SSID shown from wlan.scan() and null string for password. This is what happens;
>>> wlan.connect('SSID-name', '')
>>> scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 2
connected with SSID-name, channel 10
dhcp client start...
cnt
>>> wlan.isconnected()
False
>>> wlan.status()
1
https://docs.micropython.org/en/latest/ ... asics.html
Any suggestions as to different parameters to try?
>>> import network
>>> wlan = network.WLAN(network.STA_IF)
>>> wlan.active(True)
>>> wlan.scan()
... using the SSID shown from wlan.scan() and null string for password. This is what happens;
>>> wlan.connect('SSID-name', '')
>>> scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 2
connected with SSID-name, channel 10
dhcp client start...
cnt
>>> wlan.isconnected()
False
>>> wlan.status()
1
Re: connecting to open wifi access point?
The ESP vendor API caches the SSID and password up to 5 different WiFi connections without further notice. It seems to do this in the way that when connecting with no (or an empty) password it simply (and quietly) looks up the last credential from the mentioned cache.
Maybe you have the SSID in this cache with a wrong credential?
Maybe you have the SSID in this cache with a wrong credential?
Re: connecting to open wifi access point?
I presume this cache is in memory? I get the same results when attempting to connect after a reset or a power cycle.
I am looking at what I assume is the state transitions being printed out after "scandone". I am guessing these correspond to the states shown in the wifi.status() section of the docs; https://docs.micropython.org/en/latest/ ... twork.html
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
If that's the case it is going from IDLE to WRONG_PASSWORD to NO_AP_FOUND to GOT_IP, which seems peculiar, and a "connected with" message is actually printed. But afterwards wlan.status() shows a status of 1 which would be CONNECTING.
Maybe this is something about the access point itself, I'll find a different one to try.
I am looking at what I assume is the state transitions being printed out after "scandone". I am guessing these correspond to the states shown in the wifi.status() section of the docs; https://docs.micropython.org/en/latest/ ... twork.html
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
If that's the case it is going from IDLE to WRONG_PASSWORD to NO_AP_FOUND to GOT_IP, which seems peculiar, and a "connected with" message is actually printed. But afterwards wlan.status() shows a status of 1 which would be CONNECTING.
Maybe this is something about the access point itself, I'll find a different one to try.
Re: connecting to open wifi access point?
connection data is stored in permanent flash memory. A reboot or power cycle will not help.
To proof kfrickes thesis, rename the AP ssid to something new and definitively unknown before and try again.
To proof kfrickes thesis, rename the AP ssid to something new and definitively unknown before and try again.
Re: connecting to open wifi access point?
I am just trying to lead to some details which might help us to identify resolve this issue...
Trying another ESP as a different access point might not yield a reasonable answer
No, the cache is in flash memory of your ESP board/module. I'd suggest you try to manually connect to 6 different fantasy SSIDs and then again to your password-less one (6 to avoid an off by one error in the docs i found). Maybe you have the cache polluted with an old password. Yes that should lead to another state when connecting.Capstan wrote:I presume this cache is in memory? I get the same results when attempting to connect after a reset or a power cycle
Might help to locate the reason of the issue.Maybe this is something about the access point itself, I'll find a different one to try.
Trying another ESP as a different access point might not yield a reasonable answer
Re: connecting to open wifi access point?
Of course this is the better way!torwag wrote:connection data is stored in permanent flash memory. A reboot or power cycle will not help.
To proof kfrickes thesis, rename the AP ssid to something new and definitively unknown before and try again.