Skip to content

Conversation

@eydam-prototyping
Copy link
Contributor

Added WPS (PIN and PBC-Mode) for ESP32.

Signed-off-by: Tobias Eydam [email protected]

@eydam-prototyping
Copy link
Contributor Author

I added WPS-Support, since #4464 was not merged. I considered the post from @dpgeorge in the PR. I think, it shoud be ok now.

You can test this commit by running this code:

import network
import time

wlan = network.WLAN()
wlan.active(True)

wlan.connect(wps=True)
while wlan.status() == network.STAT_WPS_PROBING:
    print(".")
    time.sleep(1)

if wlan.status() == network.STAT_CONNECTING:
    print("WPS finished, connecting to " + wlan.config("essid"))
else:
    print("WPS failed")
    return

while wlan.status() == network.STAT_CONNECTING:
    print(".")
    time.sleep(1)
    
if wlan.isconnected():
    print("successfully connected")
    print(wlan.ifconfig())

Or you can use WPS-PIN-Mode:

import network
import time

wlan = network.WLAN()
wlan.active(True)
wlan.connect(wps=True, wps_mode=network.WPS_TYPE_PIN)
print("Enter WPS-Pin into Router: " + wlan.config("wps_pin"))
while wlan.status() == network.STAT_WPS_PROBING:
    print(".")
    time.sleep(1)

if wlan.status() == network.STAT_CONNECTING:
    print("WPS finished, connecting to " + wlan.config("essid"))
else:
    print("WPS failed")
    return

while wlan.status() == network.STAT_CONNECTING:
    print(".")
    time.sleep(1)
    
if wlan.isconnected():
    print("successfully connected")
    print(wlan.ifconfig())

When the ESP32 is connected to the WiFi, you can read the password via wlan.config("password") and store it for the next boot.

Please let me know what you think.

@eydam-prototyping eydam-prototyping marked this pull request as ready for review June 24, 2021 12:38
@eydam-prototyping
Copy link
Contributor Author

Is there anything I can do to get this merged?

@stritti
Copy link

stritti commented Jul 22, 2021

would be really awesome to have this feature 💕

@WaGi-Coding
Copy link

all the wps topics somehow die ._. Would be great to have WPS functionality

@lomby92
Copy link

lomby92 commented Jan 10, 2023

@eydam-prototyping why did you close this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants