Extracting the SSID from Photon through the command prompt?

photon
Tags: #<Tag:0x00007fe220302bb8>

#1

Hello, we have developed a custom piece of software for configuring/registering our Photons. It extracts the serial number, SSID (not in a good way, see below), renames the devices, creates database record in our database, claims the Photon, adds it to our particle product list, etc. Its automated.

The problem is how we are extracting the SSID. Currently the software types in these commands into a command prompt shell to get a list of SSIDs:
netsh interface set interface name=wi-fi admin=disabled
netsh interface set interface name=wi-fi admin=enabled
netsh wlan show networks

Our program then searches through the text and picks out the SSID. This method can sometimes be unreliable, and the biggest problem is we can only have 1 person configuring SSID’s at a time… otherwise multiple Photon SSID’s will show up in the list, and the software doesn’t know which SSID is which.

So we need a method for extracting the SSID directly from the Photon device instead. But there doesn’t really seem to be a good way of doing this?

What have you guys done, or do you have any recommendations? Thanks and any help/advice is greatly appreciated!


#2

This thread may provide an answer


#3

Thanks for the response!
One thing I just noticed… I’m looking at the API JSON from a specific device, and it has a field labeled “serial_number”: “PNH-161010-BB3X-0”.
That BB3X is actually the SSID… would this be a reliable way of extracting the SSID by using the API? I would initially do a “particle identify” in the command prompt to extract the Photons longer serial number, I could claim the device, and then look up the device via the API and the originally long serial number to get the SSID, would this work?


#4

Only as long it is a brand new device which may never have had it’s SYSTEM_CONFIG_SOFTAP_SUFFIX set to anything else.
With newer device OS versions the suffix is also six instead of four characters long and I don’t know how these extra two characters align with the serial number.


#5

So I just ran into a problem with this. I see the Photon is broadcasting its SSID as “Photon-DBT3”. Through the API I get this as the serial number:
“PHNTAB851YBT3RJ”

DBT3 is not even in the serial number on this one. The serial number scheme seems to be very inconsistent. I developed against a serial number that looked completely different.

Any other ideas? Is there really no way of me getting the SSID through the API?


#6

Did you consider my first response at all?