Page 1 of 1
WLAN.connect with bssid?
Posted: Wed Jul 13, 2022 10:55 am
by Taki7o7
Hey there, i want to prevent connecting to a network with the same name, so i'd like to use the bssid parameter, but it won't really let me
Code: Select all
def do_connect():
import network
sta_if = network.WLAN(network.STA_IF)
if not sta_if.isconnected():
print('connecting to network...')
sta_if.active(True)
sta_if.connect(ssid='myssid', password='mypass', bssid='5c:5c:5c:5c:5c:5c')
while not sta_if.isconnected():
pass
print('network config:', sta_if.ifconfig())
do_connect()
It throws TypeError: extra keyword arguments given
what am I doing wrong?

Re: WLAN.connect with bssid?
Posted: Wed Jul 13, 2022 11:49 am
by Taki7o7
Hmm, seems thats not supported at all (anymore?!) Also, no WPS? Isn't just the SSID a really bad identifier to use?
Re: WLAN.connect with bssid?
Posted: Wed Jul 13, 2022 2:09 pm
by jimmo
Taki7o7 wrote: ↑Wed Jul 13, 2022 11:49 am
Hmm, seems thats not supported at all (anymore?!) Also, no WPS? Isn't just the SSID a really bad identifier to use?
I'm fairly sure that the bssid is supported on ESP32, PYBD, and RP2 PicoW. Which port are you using?
WPS is not supported.
Re: WLAN.connect with bssid?
Posted: Wed Jul 13, 2022 2:29 pm
by Taki7o7
jimmo wrote: ↑Wed Jul 13, 2022 2:09 pm
Taki7o7 wrote: ↑Wed Jul 13, 2022 11:49 am
Hmm, seems thats not supported at all (anymore?!) Also, no WPS? Isn't just the SSID a really bad identifier to use?
I'm fairly sure that the bssid is supported on ESP32, PYBD, and RP2 PicoW. Which port are you using?
WPS is not supported.
well, ESP32 generic
Re: WLAN.connect with bssid?
Posted: Wed Jul 13, 2022 2:41 pm
by karfas
Taki7o7 wrote: ↑Wed Jul 13, 2022 10:55 am
Hey there, i want to prevent connecting to a network with the same name, so i'd like to use the bssid parameter, but it won't really let me
Code: Select all
sta_if.connect(ssid='myssid', password='mypass', bssid='5c:5c:5c:5c:5c:5c')
It throws TypeError: extra keyword arguments given
Router name and password are positional parameters.
The only keyword argument allowed is bssid - you get the extra keyword exception for ssid= and/or password=.
Code: Select all
sta_if.connect('myssid', 'mypass', bssid='5c:5c:5c:5c:5c:5c')
Can also be found by reading the station example in the fine manual at
https://docs.micropython.org/en/latest/ ... ckref.html
Re: WLAN.connect with bssid?
Posted: Wed Jul 13, 2022 3:22 pm
by Taki7o7
karfas wrote: ↑Wed Jul 13, 2022 2:41 pm
Taki7o7 wrote: ↑Wed Jul 13, 2022 10:55 am
Hey there, i want to prevent connecting to a network with the same name, so i'd like to use the bssid parameter, but it won't really let me
Code: Select all
sta_if.connect(ssid='myssid', password='mypass', bssid='5c:5c:5c:5c:5c:5c')
It throws TypeError: extra keyword arguments given
Router name and password are positional parameters.
The only keyword argument allowed is bssid - you get the extra keyword exception for ssid= and/or password=.
Code: Select all
sta_if.connect('myssid', 'mypass', bssid='5c:5c:5c:5c:5c:5c')
Can also be found by reading the station example in the fine manual at
https://docs.micropython.org/en/latest/ ... ckref.html
oh damn, thank you so much. Also i passed the bssid in wrong format ^^
Greetings from vienna to vienna

Re: WLAN.connect with bssid?
Posted: Mon Aug 01, 2022 2:57 am
by Jibun no kage
We sure it is supported for Pico, i.e. rp2? explicit use of bssid? I can't seem to get it to work. If I pass a MAC style string as bssid, I value error. If I convert the bssid to a unhexify bytes array removing the colons, I don't get any error but the connection never happens, just an endless loop where isconnected is always false.
I know the ssid and passphrase are right, they work when I let the connection attempt find the router without the explicit bssid connection attempt.
As least under Pico or rp2, the ssid and passphrase appear to be required otherwise you get a type error if the ssid is missing, and you get EPERM error if the passphrase is missing.