adafruit / Adafruit_CircuitPython_PyPortal

CircuitPython driver for Adafruit PyPortal.
MIT License
46 stars 57 forks source link

Support multiple SSID and multiple passwords #40

Closed kevinjwalters closed 4 years ago

kevinjwalters commented 5 years ago

This is easily added by detecting if the SSID and password are not strings and iterating over them.

ATMakersBill: Hi folks, is there a way to list multiple SSIDs in the secrets.py file for the PyPortal and other WiFi boards? anecdata: I think secrets.py is just a convenient place to put private stuff. Could make WiFi credentials an iterable, and randomize or cycle through in your code. ATMakersBill: The PyPortal class has code for managing the secrets file - I'm asking if that has any ability to use multiples. kjw: @ATMakersBill What's the use case for that? Portability between different places? ATMakersBill: yes cater: i think it's pretty hard wired: https://github.com/adafruit/Adafruit_CircuitPython_PyPortal/blob/master/adafruit_pyportal.py#L633

A second use-case is to deal with changing passwords, two passwords for one SSID allows for a device to work near-seamlessly across password changes.

Actually this probably belongs in adafruit_esp32spi.ESP_SPIcontrol.connect() over in https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI/blob/master/adafruit_esp32spi/adafruit_esp32spi.py but will leave that discussion for those in the know.

ladyada commented 5 years ago

you could structure the json to have sub-arrays, but please add it to the esp wifi manager first

jedgarpark commented 4 years ago

I'd love this. Ideally it would attempt to connect to the first SSID:password pair 3-4 times before moving on to the next one, since my highest signal strength AP often takes a few attempts to connect but it preferable to a different one out in my workshop when I'm inside my studio.

tannewt commented 4 years ago

FYI, I intend on splitting WifiManager out into it's own repo so that it can be used for native wifi too.