vintlabs / fauxmoESP

Add voice control of your ESP32 and ESP8266 devices using Amazon Alexa
MIT License
391 stars 71 forks source link

ESP8266 not discovered by Alexa #267

Closed IOTMan7 closed 2 weeks ago

IOTMan7 commented 2 weeks ago

I am using this code and my Alexa/Alexa App can't find the ESP can, I'm getting an IP Address and when I look it up on the web it says Not Found (espalexa)

Can anyone help

ifdef ARDUINO_ARCH_ESP32

include

include

else

include

include

endif

include

define RelayPin1 5

boolean connectWifi();

void firstLightChanged(uint8_t brightness);

const char ssid = "BCUStudents"; const char password = "";

String Device_1_Name = "Yellow LED";

boolean wifiConnected = false;

Espalexa espalexa;

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

pinMode(RelayPin1, OUTPUT);

wifiConnected = connectWifi();

if (wifiConnected)

{ espalexa.addDevice(Device_1_Name, firstLightChanged);

espalexa.begin(); } else { while (1) { Serial.println("Can't Connect to WiFi. Please Try Again"); delay(2500); } } }

void loop() { espalexa.loop(); delay(1); }

void firstLightChanged(uint8_t brightness) { if (brightness == 255) { digitalWrite(RelayPin1, LOW); Serial.println("Device1 OFF"); } else { digitalWrite(RelayPin1, HIGH); Serial.println("Device1 ON"); } }

boolean connectWifi() { boolean state = true; int i = 0;

WiFi.mode(WIFI_STA); WiFi.begin(ssid, password); Serial.println(""); Serial.println("Connecting to WiFi");

// Wait for connection Serial.print("Connecting..."); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); if (i > 20) { state = false; break; } i++; } Serial.println(""); if (state) { Serial.print("Connected to "); Serial.println(ssid); Serial.print("IP address: "); Serial.println(WiFi.localIP()); } else { Serial.println("Connection failed."); } return state; }

pvint commented 2 weeks ago

Wrong repository ;) See https://github.com/Aircoookie/Espalexa