Home

Awesome

mpy-wpa_supplicant

MicroPython module to connect to the nearest known Wifi AP.

Install

Install using mip e.g. in device REPL

>>> import mip
>>> mip.install("github:Carglglz/mpy-wpa_supplicant")

Add a wpa_supplicant.config file with SSID:PASSWORD of known Wifi APs, e.g.

{
    "Wifi-FooAlice":"lH6AFqYWE8Ppwfg8cdeVug",

    "Wifi-BarBob":"I_EnivRDJ2h34CANnEI1Hw",

    "Wifi-GuestRoom":"TXyvzOdXae_nsufOLcJWyw",

}

Usage

To connect add to main.py

from wpa_supplicant import setup_network


if setup_network():
    # Now device is connected
    # Set time with ntptime

else:
    # Device is not connected
    # Start its own AP

Options for setup_network(timeout=10, hostname=NAME, notify=True):