OpenGarage Forums OpenGarage Firmware WPA2-Enterprise? Reply To: WPA2-Enterprise?

#793

penright
Participant

Well I have have one and I am willing to test.

Using Hallgeir Holien instruction I did get it to connect to the one in our building.
Here is a thread of my trials

My biggest issue was how to convert Holien instructions into windows.
There could be still one issue. Holien instructions have you hack the libwpa2.a file. You have to change the [email protected] to your email address.
I wonder why that is not part of config parameters?

I going to see if I can keep OG from trying to config WIFI and see if it works otherwise.

After following his instructions here is my hello world.


extern "C" {
#include "user_interface.h"
#include "wpa2_enterprise.h"
}
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>

// SSID to connect to
static const char* ssid = "MySSID";
// Username for authentification
static const char* username = "MyUserName";
// Password for authentification
static const char* password = "MyPassword";
const int ledPin = 0;

void setup() {
Serial.begin(115200);
pinMode(ledPin, OUTPUT);

Serial.print("Tryingonnect to ");
Serial.println(ssid);

wifi_station_disconnect();

wifi_set_opmode(STATION_MODE);
struct station_config wifi_config;

memset(&wifi_config, 0, sizeof(wifi_config));
strcpy((char*)wifi_config.ssid, ssid);
strcpy((char*)wifi_config.password, password);
wifi_station_set_config(&wifi_config);

wifi_station_clear_cert_key();
wifi_station_clear_enterprise_ca_cert();

wifi_station_set_wpa2_enterprise_auth(1);
wifi_station_set_enterprise_username((uint8*)username, strlen(username));
wifi_station_set_enterprise_password((uint8*)password, strlen(password));
wifi_station_connect();

Serial.print("Status: ");
Serial.println(wifi_station_get_connect_status());

// Wait for connection AND IP address from DHCP
while (WiFi.status() != WL_CONNECTED) {
delay(2000);
Serial.print("Status: ");
Serial.print(wifi_station_get_connect_status());
Serial.print("  IP: ");
Serial.println(WiFi.localIP());
}

// Now we are connected
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());

} // setup

void loop() {
}