As of July 23rd 2024, we've added support into WipperSnapper for specifying backup wifi credentials, simply by adding an array of entries under the new key "alternative_networks" in your secrets file.
You can have up to 3 alternative/backup network configs, plus the original one. What original one? And what does it all look like? Well let's go through an example:
Worked Example - Just one network like before:
Here for simplicity you can see I've added my Adafruit IO username and key into the secrets.json file on my device, along with my wifi credentials for my home network (let's pretend it's called free4all and the password is password).
{
"io_username": "tyeth",
"io_key": "super_secret_key_made_of_letters_and_numbers",
"network_type_wifi": {
"network_ssid": "free4all",
"network_password": "password"
},
"status_pixel_brightness": 0.2
}
Worked Example - Add alternative networks too:
We can now add backup options for other wifi networks, like your home, office, garden, or mobile blimp...
By simply adding an extra key called alternative_networks to the network_type_wifi section of the 'secrets.json' file it can happen so easily. Don't forget to add the comma on the line before (required in json to signify there's another field to come). Then filling the new key with an array of networks (using network_ssid and network_password for each array entry) we get support added on any ESP32 (or -Sx/Cx) based board. Also the Raspberry Pi Pico W and ESP8266 have gained the same support (no SAMD yet sorry).
{
"io_username": "tyeth",
"io_key": "super_secret_key_made_of_letters_and_numbers",
"network_type_wifi": {
"network_ssid": "free4all",
"network_password": "password",
"alternative_networks": [
{
"network_ssid": "office",
"network_password": "password"
},
{
"network_ssid": "garden",
"network_password": "password"
},
{
"network_ssid": "blimp",
"network_password": "password"
}
]
},
"status_pixel_brightness": 0.2
}
Highlighted Visual Difference
If we highlight the change using git diff then hopefully you'll notice the additional comma before we insert the new alternative_networks field along with the extra array of networks:
(Red lines starting with a minus/dash '-' means removed line, Green lines starting with a plus '+' means added line)
Of course you wouldn't really commit your secrets into a version control / source control system like git, as they could be more easily exposed/leaked! In fact GitHub tries to prevent you sending changes with secrets if detected!
This page (Using multiple WiFi network credentials in Adafruit IO WipperSnapper firmware) was last updated on July 25, 2024.