🎁📬❄️📦 Holiday Shipping Deadlines are approaching! International customers and domestic ground - get your orders in 12/9/2020 📦❄️📬🎁
0

MagTag / ESP32 question
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

MagTag / ESP32 question

by FriehoffT on Fri Nov 20, 2020 4:04 am

I am starting to look at the MagTag for a project:

1. how to figure out the rssi value of the network currently connected to?
2. related to that, assuming there are multiple networks with the same ESSID in a mesh, how to connect to the "best" one.
3. Is this done "automatically" by the ESP in background? If so how to determine to which ap the board is connected?

Note:
I looked at and tried the currently available samples and they are working so far well for me.

FriehoffT
 
Posts: 15
Joined: Wed Sep 11, 2019 7:30 am

Re: MagTag / ESP32 question

by tannewt on Mon Nov 23, 2020 6:05 pm

FriehoffT wrote:1. how to figure out the rssi value of the network currently connected to?


You can do `wifi.radio.ap_info` to get a Network object back with the latest info: https://circuitpython.readthedocs.io/en ... io.ap_info

FriehoffT wrote:2. related to that, assuming there are multiple networks with the same ESSID in a mesh, how to connect to the "best" one.


We currently connect to the first channel we find the ESSID on. We have a pending PR to change this to the highest RSSI if channel and BSSID are omitted: https://github.com/adafruit/circuitpython/pull/3727

FriehoffT wrote:3. Is this done "automatically" by the ESP in background? If so how to determine to which ap the board is connected?


This is done by connect. The ap_info can give you current info

FriehoffT wrote:Note:
I looked at and tried the currently available samples and they are working so far well for me.


Great! Thanks for testing.

tannewt
 
Posts: 1922
Joined: Thu Oct 06, 2016 8:48 pm

Re: MagTag / ESP32 question

by FriehoffT on Tue Nov 24, 2020 3:50 am

Well understood, thank you!

You:
<We currently connect to the first channel we find the ESSID on. We have a pending PR to change this to the highest RSSI if channel and BSSID are omitted: >

In "readthedocs" I do not see the possibility to pass the BSSID for connect:
<connect(self, ssid: ReadableBuffer, password: ReadableBuffer = b'', *, channel: Optional[int] = 0, timeout: Optional[float] = None)>
If passing the BSSID would be possible, I think I can achieve what I am looking for.

FriehoffT
 
Posts: 15
Joined: Wed Sep 11, 2019 7:30 am

Re: MagTag / ESP32 question

by tannewt on Tue Nov 24, 2020 6:01 pm

That's a doc bug. You can provide a bytes or bytearray as `bssid` to connect. See here: https://github.com/adafruit/circuitpyth ... dio.c#L156

tannewt
 
Posts: 1922
Joined: Thu Oct 06, 2016 8:48 pm

Please be positive and constructive with your questions and comments.