Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

eydam-prototyping
Copy link
Contributor

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

Signed-off-by: Tobias Eydam eydam-prototyping@outlook.com

@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