Obtaining BSSID

Hi all

i’ve been playing around with the photon and am finding it very interesting.
i’ve been looking around and am finding libraries related to scanning the surrounding network and the getting the BSSID.
however, i’m just trying to obtain information of my connected WiFi network and was wondering if there was any way to obtain the BSSID of the connected SSID.

thanks lots

You can use WiFi.scan(), filter the results by matching the SSID of each result with the current SSID (which you get via WiFi.SSID()). The WiFiAccessPoint class includes a bssid field which contains the BSSID as 6 bytes.

thats great thanks!
was just surprised that this wasn’t exposed as a method.
to have to scan again just to obtain the BSSID seems to be a little inefficient in terms of power.
is there any information on whats the power “cost” of calling WiFi.scan() each time?

thanks lots

Yes, it’s not the most efficient way, but I figured it would at least get you what you were looking for with the tools available now until we have something more direct.

I’ll add a WiFi.BSSID() function to the backlog for inclusion in a future release.

What’s your use case? Are you building a battery powered product that’s connecting to many different networks?

Hi there

Yes. I’m building a battery powered product that needs only to report the BSSID it’s connected to via multiple networks. Which is why to scan for the same SSID again can be a hit and miss. It’ll really be great if that could be retrieved just like the other wifi parameters.

Hi @tomkut

The WiFi.BSSID() method is doc’ed and works now–it tells you the BSSID (MAC address) of the access point you are connected to.

There is no equivalent in the WiFi.scan() results for APs that you are not connected to that I am aware of.

I think the WiFiAccessPoint struct has a “bssid” member which I’m guessing should be populated. If not then we should definitely file a firmware bug, since this is like 90% of why I’d scan the networks around me. :slight_smile: