docs.rs failed to build esp-wifi-provisioning-0.1.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
esp-wifi-provisioning
WiFi provisioning via a captive-portal soft-AP for ESP32 targets, built on esp-idf-svc. When a device has no stored credentials, it broadcasts a setup access point and serves a small web UI. Users connect, pick their network, enter a password, and the device saves the credentials to NVS and connects. No hardcoded SSIDs, no serial flashing required.
How it works
- On boot, stored NVS credentials are tried first. If they work, the portal never appears.
- If there are no credentials (or they fail), a soft-AP is started and a captive portal is served.
- The user connects to the AP, is redirected to the setup page automatically, and submits their WiFi credentials.
- The device connects in station mode, persists the credentials to NVS, and returns the connected WiFi driver.
- On the next boot, step 1 succeeds and provisioning completes silently.
Usage
Add the crate to your Cargo.toml:
[]
= "0.1"
Then call [Provisioner::provision] in your application entry point:
use Provisioner;
// wifi: BlockingWifi<EspWifi<'static>>
// nvs: EspNvsPartition<NvsDefault>
let wifi = new
.ap_ssid
.provision
.expect;
// `wifi` is now connected, use it as normal.
Customisation
Password-protect the setup AP and tune the connection retry behaviour:
use Duration;
use ;
let wifi = new
.ap_ssid
.ap_password // omit to leave the setup AP open (default)
.retry_config
.provision?;
Use ApConfig directly when you need to control the channel or AP IP address:
use Ipv4Addr;
use ;
let wifi = new
.ap_config
.provision?;
Factory reset / re-provisioning
let provisioner = new;
provisioner.clear_credentials?; // wipe NVS, portal will appear on next boot
Requirements
- Target: ESP32 (tested via
esp-idf-svc) - Rust: 1.85 or later (edition 2024)
esp-idf-svcandesp-idf-halmust be present in your workspace or dependency tree
License
This software is licensed under the MIT license