Information esp-idf update

Hi everyone,
I am developing a project with wroom32. I tried to use the WPS example, but got an error for “wifi_event_sta_wps_er_success_t” because it is not defined.
Searching the web, I found that it is a feature of version 4.2. So is there a workaround for version 4.1? Or when v4.2 will be available on platformio?

Thanks.

Are you sure you can’t just use the WPS example intended for the version PlatformIO uses (4.1), at esp-idf/examples/wifi/wps at v4.1 · espressif/esp-idf · GitHub?

This issue is already tracked in Add support for ESP-IDF v4.2 · Issue #455 · platformio/platform-espressif32 · GitHub, but no developer has responded yet.

I need to know the connection’s SSID and password. With the 4.1 example those informations aren’t available. Or there is another way to get it with 4.1 idf version using WPS?

Well technically since the WPS code does

So the SSID and password are stored in the config and given to esp_wifi_set_config, after WPS has finished, you can just use the getter function again by

so by e.g. calling

wifi_config_t config;
esp_err_t err = esp_wifi_get_config(WIFI_IF_STA, &config);
if (err == ESP_OK) {
  printf("SSID: %s, PW: %s\n", (char*) config.sta.ssid, (char*) config.sta.password);
} else {
  printf("Couldn't get config: %d\n", (int) err);
}

and you can then find the SSID and password in that struct again.

Caveat is that ESP-IDF v4.1 only seems to work when the WPS procedure returns 1 SSID and password, not multiple ones. For that an update to v4.2 must be awaited.

Thank you for your help. I’m going to try your solution.