How to lists available APs include MAC on Micropython ?

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
User avatar
water
Posts: 75
Joined: Sun Sep 24, 2017 9:16 am

How to lists available APs include MAC on Micropython ?

Post by water » Sat Feb 24, 2018 6:44 am

How to lists available APs included MAC on Micropython likes AT instruction set "AT+CWLAP" ?
I use ">>> sta_if.scan()" to lists available APs is not included MAC.

Thanks.

cefn
Posts: 230
Joined: Tue Aug 09, 2016 10:58 am

Re: How to lists available APs include MAC on Micropython ?

Post by cefn » Sat Feb 24, 2018 3:56 pm

Is there no BSSID entry in the second position as per https://docs.micropython.org/en/latest/ ... twork.scan ?

Apparently BSSID corresponds with MAC address of the Access point.

On my ESP8266 I get...

Code: Select all

>>> import network
>>> nic = network.WLAN(network.STA_IF)
>>> nic.active(True)
mode : sta(a0:20:a6:06:d8:8e) + softAP(a2:20:a6:06:d8:8e)
#5 ets_task(4020ed88, 28, 3fff9fa0, 10)
add if0
>>> nic.scan()
scandone
[(b'SkyHome', b'H\x8d6\xdc\x16\\', 1, -50, 4, 0), (b'SKYA3BC9', b'\x90!\x06\xc9)\xf1', 1, -84, 3, 0), (b'PS4-63E5C4F1030A', b'\xec\x0e\xc4\xccaG', 6, -93, 3, 0), (b'BTHub6-G29T', b'\xac\x84\xc9\xb0g\xb6', 6, -92, 3, 0), (b'BTWifi-with-FON', b'\xae\x84\xc9\xb0i\xb7', 6, -93, 0, 0), (b'BTWifi-X', b'\xae\x84\xc9\xb0i\xb4', 6, -90, 5, 0), (b'SKY56CDC', b'\x90!\x06\xaai\xf9', 1, -91, 3, 0)]
It might look more familiar as a Mac address if you do this...

Code: Select all

>>> bssid = b'H\x8d6\xdc\x16\\'
>>> print(":".join([hex(b)[2:] for b in bssid]))
48:8d:36:dc:16:5c

User avatar
water
Posts: 75
Joined: Sun Sep 24, 2017 9:16 am

Re: How to lists available APs include MAC on Micropython ?

Post by water » Sat Feb 24, 2018 7:44 pm

MAC same as BSSID ,Unexpectedly.
Thanks.

Post Reply