Connecting to unsecured WiFi

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
KMcLoud
Posts: 7
Joined: Sun Oct 30, 2016 1:06 pm

Connecting to unsecured WiFi

Post by KMcLoud » Mon Mar 27, 2017 9:03 am

I am attempting to connect to an unsecured WiFi network in station mode, and cannot make it work.

Everything works fine with WPA secured networks.

The docs list None as as acceptable value for the security field in the auth tuple, suggesting that it should be possible.

However, the docs do not specify what should be passed into the password field when None is given for security.

I've tried passing None and an empty string into the password field, neither has worked.

KMcLoud
Posts: 7
Joined: Sun Oct 30, 2016 1:06 pm

Re: Connecting to unsecured WiFi

Post by KMcLoud » Mon Mar 27, 2017 9:38 am

I figured it out!

though the solution is so simple its a bit embarrassing to admit the mistake...

auth is an optional argument in the WLAN.connect method, and apparently passing it a tuple causes problems when dealing with unsecured networks.

So, for clarity, the method call to connect to an unsecured WiFi network named 'bob' is simply:

WLAN.connect('bob')

Given that this is the case, does anyone know why the docs list None as an acceptable value for security in the auth tuple? Is there some other situation where you would use that?

Post Reply