Skip to content

ports/esp32/modnetwork.c: Added WPS. - #7452

Closed
eydam-prototyping wants to merge 0 commit into
micropython:masterfrom
eydam-prototyping:ESP32_WPS
Closed

eydam-prototyping wants to merge 0 commit into
micropython:masterfrom
eydam-prototyping:ESP32_WPS

Conversation

@eydam-prototyping

Copy link
Copy Markdown
Contributor

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

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

@eydam-prototyping

Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Is there anything I can do to get this merged?

@stritti

stritti commented Jul 22, 2021

Copy link
Copy Markdown

would be really awesome to have this feature 💕

@WaGi-Coding

Copy link
Copy Markdown

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

@lomby92

lomby92 commented Jan 10, 2023

Copy link
Copy Markdown

@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