WLAN.STA not working after 1.1.0 [sorted]

Questions and discussion about The WiPy 1.0 board and CC3200 boards.
Target audience: Users with a WiPy 1.0 or CC3200 board.
Post Reply
Saran
Posts: 16
Joined: Thu May 28, 2015 6:52 pm

WLAN.STA not working after 1.1.0 [sorted]

Post by Saran » Thu Oct 22, 2015 6:43 pm

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?
Last edited by Saran on Mon Oct 26, 2015 2:10 pm, edited 1 time in total.

User avatar
danicampora
Posts: 342
Joined: Tue Sep 30, 2014 7:20 am
Contact:

Re: WLAN.STA not working after 1.1.0

Post by danicampora » Fri Oct 23, 2015 12:02 pm

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

Saran
Posts: 16
Joined: Thu May 28, 2015 6:52 pm

Re: WLAN.STA not working after 1.1.0

Post by Saran » Fri Oct 23, 2015 12:51 pm

Thanks.

Post Reply