Page 1 of 1

WLAN.STA not working after 1.1.0 [sorted]

Posted: Thu Oct 22, 2015 6:43 pm
by Saran
I've this scropt working on 1.0.0:

Code: Select all

# boot.py -- run on boot-up
# can run arbitrary Python, but best to keep it minimal
from network import WLAN

wifi = WLAN(mode=WLAN.STA)
nets = wifi.scan()
for net in nets:
    if net.ssid.lower() == 'ssid1':
        wifi.connect(net.ssid, auth=(net.auth, 'passwd'))
        break
    elif net.ssid.lower() == 'ssid2':
        wifi.connect(net.ssid, auth=(net.auth, 'passwd2')
        break
But when I upgraded to 1.1.0, it no longer works. I've checked the API and nothing has changed that would impact it.

I've tried changing line endings to CRLF (Win) and to LF (Unix), but w/o any success.

Also tried with:

Code: Select all

wifi.connect(ssid=net.ssid, auth=(net.auth, 'passwd')
but w/o any success.

Ideas?

Re: WLAN.STA not working after 1.1.0

Posted: Fri Oct 23, 2015 12:02 pm
by danicampora
Hi,

Sorry, there was a small API change regarding the scan results, from the docs:
Performs a network scan and returns a list of named tuples with (ssid, bssid, sec, channel, rssi).
Also in the release notes: https://github.com/wipy/wipy/releases
in scan results rename 'auth' field to 'sec'
So, change your line to:

Code: Select all

wifi.connect(ssid=net.ssid, auth=(net.sec, 'passwd')
I know this is not optimal, but the API is getting very stable, and besides the Timer class, all other parts will remain as they are now.

Cheers,
Daniel

Re: WLAN.STA not working after 1.1.0

Posted: Fri Oct 23, 2015 12:51 pm
by Saran
Thanks.