adafruit / Adafruit_CircuitPython_ESP32SPI

ESP32 as wifi with SPI interface
MIT License
103 stars 75 forks source link

allow for list in secrets[ssid] #117

Closed slootsky closed 3 years ago

slootsky commented 3 years ago

check secrets["ssid"] to see if it is a list or a tuple, and if so, loop through it

adafruit_esp32spi_wifimanager allows a list or tuple, and this brings adafruit_esp32spi into line with that.

This code gets the ESP to use a list or a string for secrets["ssid"]

slootsky commented 3 years ago

a) that test failure doesn't have anything to do with my code, but I don't know how to force a retest without making an unnecessary code change. b) with regards to your comment that this doesn't belong in this library, the adafruit_esp32spi_wifimanager accepts ssid and password as lists/tuples. This makes this code more compatible with wifimanager. If the user wants to supply a string, then they get explicit control over which ssid they connect to, otherwise the connection attempts happen in the order of the list in secrets["ssid"]

tannewt commented 3 years ago

Why can't you use wifimanager then? This seems like a very special case for this class.

slootsky commented 3 years ago

this code makes the ssid and password in the secrets dictionary compatible between wifimanager and this class. Without this, a list that works in wifimanager won't work here.

Having multiple ssids configured is good for a device that may not be in the same location all the time

tannewt commented 3 years ago

I understand that this code makes them match. What is not clear to me is why you aren't just using WifiManager already. This code already does way more than it should. There is no reason this low level needs to manage what essid to connect to.

slootsky commented 3 years ago

Sounds like you don't think this code should be modified to accept a list.

Would you like me to close the pull request then?

tannewt commented 3 years ago

@slootsky Yup. You could provide an example or just close. Thank you for the PR anyway!