2023-04-10 03:40:30 +01:00
2023-02-24 23:41:04 +00:00
2023-03-17 20:41:19 +00:00
2022-12-10 19:29:59 +00:00
2023-04-10 03:40:30 +01:00
2023-04-10 03:40:30 +01:00
2023-02-24 23:31:55 +00:00
2022-12-08 02:12:13 +00:00
2022-12-10 19:51:49 +00:00

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):

  • timeout: In seconds to wait for connection [default: 10]

  • hostname: Hostname of the device, [default: sys.platform-unique_id, e.g. esp32-7c9ebd3d9df4]

  • notify: To print connection status and ifconfig info [default: True]

Description
MicroPython wpa-supplicant
Readme MIT 37 KiB
Languages
Python 100%