ESP8266 w/ Alexa Help

I am doing a Home Automation Senior Project and my Amazon Alexa App is not finding the ESP8266 when I run the code I get this in the Serial Monitor. Can anyone please help me

Responding search req...
����������������������������������������������������������������ot-Found HTTP call:
URI: /api/2WLEDHardQrI3WHYTHoMcXHgEspsM8ZZRpSKtBQr/lights/1988806784
Body:
AlexaApiCall
ok
l1988806784
1988806784
Got UDP!
M-SEARCH * HTTP/1.1
Host: 239.255.255.250:1900
ST: urn:schemas-upnp-org:device:InternetGatewayDevice:1
Man: "ssdp:discover"
MX: 3

#ifdef ARDUINO_ARCH_ESP32
#include <ESPmDNS.h>
#include <WiFi.h>
#else
#include <ESP8266mDNS.h>
#include <ESP8266WiFi.h>
#endif
#define ESPALEXA_DEBUG
#include <Espalexa.h>


#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;
}

I think the letter N got clobbered in the initialization phase, just press the reset button should solve that, but the error is quite clear, you have the wrong URL.

Where do I find the right URL

Sorry, no idea.
I have downloaded your code and will try it. After changing creds it worked.
Here is the output
Your bad URL error is likely a glitch, just reset the board or re-upload. Here is proof of working

I have pressed the RST Button on the ESP multiple times and reuploaded the Code and I keep getting the error

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.