Page 1 of 1

WiFi station mode password

Posted: Thu Jul 14, 2022 12:13 am
by OutoftheBOTS_
I have added this line in my Wifi setup
ap.config(essid="ESP32", password="OOTB")
It sets the essid fine but doesn't require a password to connect.

Is there a way to password protect the ESP32 in station mode so that only people with the password can connect to the ESP32

Re: WiFi station mode password

Posted: Thu Jul 14, 2022 12:42 am
by davef
[quote ...]ESP32 in station mode[/quote] Think you mean AP mode. There use to be a file in the standard micropython build that when you booted the first time it asked for a password.

Maybe, this helps:

Code: Select all

https://forum.micropython.org/viewtopic.php?t=3669

Re: WiFi station mode password

Posted: Thu Jul 14, 2022 12:48 am
by jimmo
OutoftheBOTS_ wrote:
Thu Jul 14, 2022 12:13 am
It sets the essid fine but doesn't require a password to connect.
You also need to set the `security` option in ap.config to tell it which security mode to use.

Code: Select all

ap.config(essid="ESP32", password="OOTB", security=network.AUTH_WPA2_PSK)
(Note: in older firmware this was called "authmode". As of 1.19.1, both options are accepted).

See https://docs.micropython.org/en/latest/ ... LAN.config and https://docs.micropython.org/en/latest/ ... .WLAN.scan

Re: WiFi station mode password

Posted: Fri Jul 15, 2022 8:22 am
by OutoftheBOTS_
thanks

Re: WiFi station mode password

Posted: Mon Jul 18, 2022 8:12 am
by OutoftheBOTS_
jimmo wrote:
Thu Jul 14, 2022 12:48 am

Code: Select all

ap.config(essid="ESP32", password="OOTB", security=network.AUTH_WPA2_PSK)
That threw an error

Code: Select all

Traceback (most recent call last):
  File "boot.py", line 4, in <module>
ValueError: unknown config param
MicroPython v1.19.1 on 2022-06-18; ESP32 module with ESP32
Type "help()" for more information.
but this did work

Code: Select all

authmode=network.AUTH_WPA2_PSK

Re: WiFi station mode password

Posted: Tue Jul 19, 2022 1:28 am
by jimmo
OutoftheBOTS_ wrote:
Mon Jul 18, 2022 8:12 am
but this did work
Sorry, I said the wrong thing. I should have said that it's been renamed _after_ 1.19.1 (the commit was merged later in the same day).