Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Carglglz/mpy-wpa_supplicant
MicroPython wpa-supplicant
https://github.com/Carglglz/mpy-wpa_supplicant
Last synced: 3 months ago
JSON representation
MicroPython wpa-supplicant
- Host: GitHub
- URL: https://github.com/Carglglz/mpy-wpa_supplicant
- Owner: Carglglz
- License: mit
- Created: 2022-12-10T19:26:27.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-04-10T02:40:46.000Z (over 1 year ago)
- Last Synced: 2024-04-22T12:33:45.874Z (7 months ago)
- Language: Python
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-micropython - mpy-wpa_supplicant - MicroPython module to connect to the nearest known Wifi AP. (Libraries / Communications)
README
## 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`
```py
from wpa_supplicant import setup_networkif setup_network():
# Now device is connected
# Set time with ntptimeelse:
# 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`]