Dependencies¶
This driver depends on:
Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle.
Usage Example¶
This module implements a child class build upon Adafruit’s PyPortal class. The class implements just one method, overriding a base method, allowing the PyPortal device to connect to more than one SSID. To use, invoke this class where you would have used the PyPortal class. For example:
from pyportal_multissid import PyPortal_MultiSSID
pyportal = PyPortal_MultiSSID(status_neopixel=board.NEOPIXEL)
Configure your “home” network as ‘ssid’ and ‘password’ as usual in your secrets.py file, then add any additional networks (such as phone hotspot, MiFi devices, and networks at places the PyPortal will visit) as described below. The PyPortal then becomes portable.
The alteration of secrets.py is to include one extra key/value pair. The key is ‘hotspots’ and the value is a list of pairs of ssid and password strings:
secrets = {
# Whatever is already in your secrets dict remains.
# Be sure to add a now-needed comma if there isn't one.
'hotspots': [
['myphonessid', 'thepassword'],
['mymifissid', 'itspassword'],
['myvacationhomessid', 'dontyouwish'],
],
}
See examples/pyportal_multissid_simpletest.py
Contributing¶
Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.
Documentation¶
For information on building library documentation, please check out this guide.
Table of Contents¶
Simple test¶
Ensure your device works with this simple test.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | """Simple test of PyPortal_MultiSSID
"""
# This test requires a secrets.py file on your PyPortal.
# At a minimum, the secrets dictionary in that file will contain:
# * Your Adafruit IO username and key, required for get_local_time()
# * The ssid and password of your "home" network.
# * A hotspots entry that will be a list of ssid/password tuples
# corresponding to "away" networks, such as your phone operating
# as a hotspot, a "MiFi" device, or any other place you expect
# the device to operate.
# Note: Places like hotels and Starbucks are not supported because
# they require visiting a sign-in page and interacting with it.
# This class is for known, passphrase-protected networks with
# no web-based sign-in.
import time
import board
from pyportal_multissid import PyPortal_MultiSSID
# PyPortal_MultiSSID class is invoked exactly the same way as PyPortal.
pyportal = PyPortal_MultiSSID(status_neopixel=board.NEOPIXEL)
while True:
try:
pyportal.get_local_time()
except RuntimeError:
print('get_local_time failed...')
time.sleep(60)
|
pyportal_multissid
¶
Allows PyPortal to connect to multiple SSIDs
- Author(s): Gregory M Paris
Implementation Notes¶
Hardware:
Software and Dependencies:
- Adafruit CircuitPython firmware for the supported boards: https://github.com/adafruit/circuitpython/releases
- Adafruit’s PyPortal library: https://github.com/adafruit/Adafruit_CircuitPython_PyPortal
-
class
pyportal_multissid.
PyPortal_MultiSSID
(*args, **kwargs)¶ Overrides PyPortal class method to allow for multiple SSIDs.