Skip to content

How to connect via WPS? #1958

@re3lex

Description

@re3lex

Hi,

My router is setup to accept clients using WPS button.
I'm trying to connect my ESP (please find listing below) to that router using WiFi.beginWPSConfig() method but program hangs about 3 minutes on that line an then reports about failed connection.

I googled a lot but found couple of blog posts but code used there doesn't work for some reasons.

How to connect to router using WPS?
Is that possible?

#include <ESP8266WiFi.h>


void setup() {
  Serial.begin(115200);

  // Long delay required especially soon after power on.
  delay(4000);
  // Check if WiFi is already connected and if not, begin the WPS process.
  if (WiFi.status() != WL_CONNECTED) {
      Serial.println("\nAttempting connection ...");
      WiFi.beginWPSConfig();
      // Another long delay required.
      delay(3000);
      if (WiFi.status() == WL_CONNECTED) {
        Serial.println("Connected!");
        Serial.println(WiFi.localIP());
        Serial.println(WiFi.SSID());
        Serial.println(WiFi.macAddress());
      }
      else {
        Serial.println("Connection failed!");
      }
  }
  else {
    Serial.println("\nConnection already established.");
  }
}

void loop() {
  // put your main code here, to run repeatedly:

}

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions