Aircoookie / Espalexa

Alexa voice control for ESP8266/ESP32 (including brightness and color!)
MIT License
539 stars 134 forks source link

Unable to discover device in Alexa App #137

Open phani87 opened 3 years ago

phani87 commented 3 years ago

New to ESP8266 and Alexa.

I am sure I am doing something wrong. Can you tell how to fix this ?

My Project Setup WhatsApp Image 2020-10-11 at 1 54 38 PM

My Code :

`#define ESPALEXA_DEBUG

include

include

include

Servo blindServo;

static const int servoPin = 15; // The Pin which the Servo is connected to const int button1Pin = 5; // The Pin which Button 1 is connected to const int button2Pin = 4; // The Pin which Button 2 is connected to

int servoPosition = 0; // This sets the initial postiion of the servo

// prototypes boolean connectWifi();

//callback functions void servoPositionChanged(uint8_t servoPosition);

// CHANGE THE SSID AND PASSWORD TO MATCH YOUR OWN WIFI SETUP const char ssid = "arcola24677"; const char password = "pharvi8789";

boolean wifiConnected = false;

Espalexa espalexa;

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

blindServo.attach(servoPin);

pinMode(button1Pin, INPUT_PULLUP); // Set the button so that the controller reads LOW when pressed pinMode(button2Pin, INPUT_PULLUP); // Set the button so that the controller reads LOW when pressed

// Initialise wifi connection wifiConnected = connectWifi();

if (wifiConnected) {

// Define your devices here.
espalexa.addDevice("phani_blinds", servoPositionChanged, 20); //simplest definition, default state off
espalexa.begin();

} else { while (1) { Serial.println("Cannot connect to WiFi. Please check data and reset the ESP."); delay(2500); } } }

void loop() {

while (digitalRead(button1Pin) == LOW && servoPosition < 179) { blindServo.attach(servoPin); // This activates the servo (Attaches the servo) servoPosition++; blindServo.write(servoPosition); Serial.println(servoPosition); delay(15); blindServo.detach(); // This deactivates the servo (Detahces the servo) so there is no noise from the servo when the movement has finished } while (digitalRead(button2Pin) == LOW && servoPosition > 0) { blindServo.attach(servoPin); servoPosition--; blindServo.write(servoPosition); Serial.println(servoPosition); delay(15); blindServo.detach(); }

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

//our callback functions void servoPositionChanged(uint8_t servoPosition) { Serial.print("Servo Position changed to ");

if (servoPosition < 180) {

blindServo.attach(servoPin);

Serial.print("Servo Position ");
Serial.println(servoPosition);

blindServo.write(servoPosition);

servoPosition = servoPosition;

delay(1000);

blindServo.detach();

} else { Serial.print("Servo Out of Range "); Serial.println(servoPosition); } }

// connect to wifi – returns true if successful or false if not 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; }`

Debugger Response: 13:40:11.197 -> ⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮:\⸮⸮&#a-0⸮⸮⸮&⸮p⸮D⸮⸮&⸮pz0⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮&⸮⸮⸮⸮⸮⸮⸮⸮"⸮⸮⸮⸮&⸮h⸮⸮&⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮@ܞ⸮⸮&⸮⸮⸮⸮⸮&⸮⸮ 13:43:15.230 -> ⸮⸮⸮&⸮⸮N⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮&⸮p⸮⸮"⸮⸮&⸮⸮⸮⸮⸮⸮0⸮f"⸮⸮⸮⸮60⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮&⸮⸮:,⸮⸮&⸮⸮ 13:47:08.704 -> 6⸮⸮⸮D\&⸮⸮⸮&⸮p⸮"⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮\~⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮&#⸮⸮⸮⸮&⸮x⸮C⸮⸮"⸮t⸮`"⸮⸮&⸮:0⸮⸮&⸮⸮ ⸮⸮&⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮&⸮X-,⸮⸮&A⸮:L⸮⸮⸮"⸮⸮⸮ ⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮&⸮⸮: ⸮⸮⸮⸮6L⸮⸮&⸮⸮ ⸮⸮

phani87 commented 3 years ago

Update Serial Monitor output : 15:00:44.498 -> ⸮oNlNs⸮۲N B$r⸮⸮⸮ bl`⸮b ⸮⸮d⸮l{⸮ ⸮⸮N⸮.wifi evt: 2 15:00:45.222 -> ....scandone 15:00:47.098 -> state: 0 -> 2 (b0) 15:00:47.098 -> state: 2 -> 3 (0) 15:00:47.098 -> state: 3 -> 5 (10) 15:00:47.098 -> add 0 15:00:47.098 -> aid 6 15:00:47.098 -> cnt 15:00:47.098 -> 15:00:47.098 -> connected with arcola24677, channel 11 15:00:47.098 -> dhcp client start... 15:00:47.135 -> wifi evt: 0 15:00:47.135 -> ip:192.168.86.125,mask:255.255.255.0,gw:192.168.86.1 15:00:47.135 -> wifi evt: 3 15:00:47.244 -> . 15:00:47.244 -> Connected to arcola24677 15:00:47.244 -> IP address: 192.168.86.125 15:00:47.244 -> Constructing device 1 15:00:47.244 -> Adding device 1 15:00:47.244 -> Espalexa Begin... 15:00:47.244 -> MAXDEVICES 10 15:00:47.244 -> Done 15:00:55.901 -> :urn 387 15:00:55.901 -> Got UDP! 15:00:55.901 -> :urd 254, 387, 0 15:00:56.147 -> :urn 451 15:00:56.147 -> Got UDP! 15:00:56.147 -> :urd 254, 451, 0 15:00:56.184 -> :urn 467 15:00:56.184 -> Got UDP! 15:00:56.184 -> :urd 254, 467, 0 15:00:56.184 -> :urn 451 15:00:56.184 -> Got UDP! 15:00:56.184 -> :urd 254, 451, 0 15:00:56.184 -> :urn 449 15:00:56.184 -> Got UDP! 15:00:56.184 -> :urd 254, 449, 0 15:00:56.184 -> :urch 477, 396 15:00:56.184 -> Got UDP! 15:00:56.184 -> :urd 254, 396, 0 15:00:56.220 -> :urn 435 15:00:56.220 -> Got UDP! 15:00:56.220 -> :urd 254, 435, 0 15:00:56.220 -> :urn 455 15:00:56.220 -> Got UDP! 15:00:56.220 -> :urd 254, 455, 0 15:00:56.220 -> :urn 396 15:00:56.220 -> Got UDP! 15:00:56.220 -> :urd 254, 396, 0 15:00:56.220 -> :urn 459 15:00:56.220 -> Got UDP! 15:00:56.254 -> :urd 254, 459, 0 15:00:56.254 -> :urch 487, 387 15:00:56.254 -> Got UDP! 15:00:56.254 -> :urd 254, 387, 0 15:00:56.254 -> :urn 396 15:00:56.254 -> Got UDP! 15:00:56.254 -> :urd 254, 396, 0 15:00:57.087 -> pm open,type:2 0 15:01:04.586 -> :urn 174 15:01:04.586 -> Got UDP! 15:01:04.586 -> :urd 174, 174, 0 15:01:04.624 -> M-SEARCH HTTP/1.1 15:01:04.624 -> HOST: 239.255.255.250:1900 15:01:04.624 -> MAN: "ssdp:discover" 15:01:04.624 -> MX: 1 15:01:04.624 -> ST: urn:dial-multiscreen-org:service:dial:1 15:01:04.624 -> USER-AGENT: Google Chrome/86.0.4240.75 Mac OS X 15:01:04.624 -> 15:01:04.624 -> 15:01:05.630 -> :urn 174 15:01:05.630 -> Got UDP! 15:01:05.630 -> :urd 174, 174, 0 15:01:05.630 -> M-SEARCH HTTP/1.1 15:01:05.630 -> HOST: 239.255.255.250:1900 15:01:05.630 -> MAN: "ssdp:discover" 15:01:05.630 -> MX: 1 15:01:05.630 -> ST: urn:dial-multiscreen-org:service:dial:1 15:01:05.630 -> USER-AGENT: Google Chrome/86.0.4240.75 Mac OS X 15:01:05.630 -> 15:01:05.630 -> 15:01:06.631 -> :urn 174 15:01:06.665 -> Got UDP! 15:01:06.665 -> :urd 174, 174, 0 15:01:06.665 -> M-SEARCH HTTP/1.1 15:01:06.665 -> HOST: 239.255.255.250:1900 15:01:06.665 -> MAN: "ssdp:discover" 15:01:06.665 -> MX: 1 15:01:06.665 -> ST: urn:dial-multiscreen-org:service:dial:1 15:01:06.665 -> USER-AGENT: Google Chrome/86.0.4240.75 Mac OS X 15:01:06.665 -> 15:01:06.665 -> 15:01:07.673 -> :urn 174 15:01:07.673 -> Got UDP! 15:01:07.673 -> :urd 174, 174, 0 15:01:07.673 -> M-SEARCH HTTP/1.1 15:01:07.673 -> HOST: 239.255.255.250:1900 15:01:07.673 -> MAN: "ssdp:discover" 15:01:07.673 -> MX: 1 15:01:07.673 -> ST: urn:dial-multiscreen-org:service:dial:1 15:01:07.673 -> USER-AGENT: Google Chrome/86.0.4240.75 Mac OS X 15:01:07.709 -> 15:01:07.709 -> 15:01:56.002 -> :urn 387 15:01:56.002 -> Got UDP! 15:01:56.002 -> :urd 254, 387, 0 15:01:56.212 -> :urn 451 15:01:56.212 -> Got UDP! 15:01:56.212 -> :urd 254, 451, 0 15:01:56.249 -> :urn 467 15:01:56.249 -> Got UDP! 15:01:56.249 -> :urd 254, 467, 0 15:01:56.249 -> :urch 495, 451 15:01:56.249 -> Got UDP! 15:01:56.249 -> :urd 254, 451, 0 15:01:56.249 -> :urn 396 15:01:56.249 -> Got UDP! 15:01:56.249 -> :urd 254, 396, 0 15:01:56.249 -> :urn 435 15:01:56.249 -> Got UDP! 15:01:56.249 -> :urd 254, 435, 0 15:01:56.249 -> :urch 463, 396 15:01:56.249 -> Got UDP! 15:01:56.249 -> :urd 254, 396, 0 15:01:56.249 -> :urn 455 15:01:56.249 -> Got UDP! 15:01:56.249 -> :urd 254, 455, 0 15:01:56.285 -> :urn 396 15:01:56.285 -> Got UDP! 15:01:56.285 -> :urd 254, 396, 0 15:01:56.285 -> :urch 424, 459 15:01:56.285 -> Got UDP! 15:01:56.285 -> :urd 254, 459, 0 15:01:56.285 -> :urch 487, 387 15:01:56.285 -> Got UDP! 15:01:56.285 -> :urd 254, 387, 0 15:02:56.038 -> :urn 387 15:02:56.038 -> Got UDP! 15:02:56.038 -> :urd 254, 387, 0 15:02:56.217 -> :urn 451 15:02:56.217 -> Got UDP! 15:02:56.217 -> :urd 254, 451, 0 15:02:56.217 -> :urch 479, 467 15:02:56.217 -> Got UDP! 15:02:56.217 -> :urd 254, 467, 0 15:02:56.217 -> :urch 495, 449 15:02:56.217 -> Got UDP! 15:02:56.252 -> :urd 254, 449, 0 15:02:56.252 -> :urch 477, 451 15:02:56.252 -> Got UDP! 15:02:56.252 -> :urd 254, 451, 0 15:02:56.252 -> :urch 479, 396 15:02:56.252 -> Got UDP! 15:02:56.252 -> :urd 254, 396, 0 15:02:56.290 -> :urn 435 15:02:56.290 -> Got UDP! 15:02:56.290 -> :urd 254, 435, 0 15:02:56.290 -> :urn 455 15:02:56.290 -> Got UDP! 15:02:56.290 -> :urd 254, 455, 0 15:02:56.290 -> :urn 396 15:02:56.290 -> Got UDP! 15:02:56.290 -> :urd 254, 396, 0 15:02:56.290 -> :urn 396 15:02:56.290 -> Got UDP! 15:02:56.290 -> :urd 254, 396, 0 15:02:56.290 -> :urn 459 15:02:56.290 -> Got UDP! 15:02:56.290 -> :urd 254, 459, 0 15:02:56.290 -> :urch 487, 387 15:02:56.290 -> Got UDP! 15:02:56.326 -> :urd 254, 387, 0 15:03:04.631 -> :urn 174 15:03:04.631 -> Got UDP! 15:03:04.631 -> :urd 174, 174, 0 15:03:04.631 -> M-SEARCH HTTP/1.1 15:03:04.631 -> HOST: 239.255.255.250:1900 15:03:04.631 -> MAN: "ssdp:discover" 15:03:04.631 -> MX: 1 15:03:04.631 -> ST: urn:dial-multiscreen-org:service:dial:1 15:03:04.631 -> USER-AGENT: Google Chrome/86.0.4240.75 Mac OS X 15:03:04.631 -> 15:03:04.631 -> 15:03:05.634 -> :urn 174 15:03:05.634 -> Got UDP! 15:03:05.634 -> :urd 174, 174, 0 15:03:05.634 -> M-SEARCH HTTP/1.1 15:03:05.634 -> HOST: 239.255.255.250:1900 15:03:05.634 -> MAN: "ssdp:discover" 15:03:05.634 -> MX: 1 15:03:05.634 -> ST: urn:dial-multiscreen-org:service:dial:1 15:03:05.634 -> USER-AGENT: Google Chrome/86.0.4240.75 Mac OS X 15:03:05.669 -> 15:03:05.669 -> 15:03:06.643 -> :urn 174 15:03:06.678 -> Got UDP! 15:03:06.678 -> :urd 174, 174, 0 15:03:06.678 -> M-SEARCH HTTP/1.1 15:03:06.678 -> HOST: 239.255.255.250:1900 15:03:06.678 -> MAN: "ssdp:discover" 15:03:06.678 -> MX: 1 15:03:06.678 -> ST: urn:dial-multiscreen-org:service:dial:1 15:03:06.678 -> USER-AGENT: Google Chrome/86.0.4240.75 Mac OS X 15:03:06.678 -> 15:03:06.678 -> 15:03:07.688 -> :urn 174 15:03:07.688 -> Got UDP! 15:03:07.688 -> :urd 174, 174, 0 15:03:07.688 -> M-SEARCH HTTP/1.1 15:03:07.688 -> HOST: 239.255.255.250:1900 15:03:07.688 -> MAN: "ssdp:discover" 15:03:07.688 -> MX: 1 15:03:07.688 -> ST: urn:dial-multiscreen-org:service:dial:1 15:03:07.688 -> USER-AGENT: Google Chrome/86.0.4240.75 Mac OS X 15:03:07.727 -> 15:03:07.727 -> 15:03:38.917 -> :urn 94 15:03:38.917 -> Got UDP! 15:03:38.917 -> :urd 94, 94, 0 15:03:38.917 -> M-SEARCH HTTP/1.1 15:03:38.917 -> HOST: 239.255.255.250:1900 15:03:38.952 -> MAN: "ssdp:discover" 15:03:38.952 -> MX: 5 15:03:38.952 -> ST: ssdp:all 15:03:38.952 -> 15:03:38.952 -> 15:03:38.952 -> Responding search req... 15:03:56.322 -> :urn 451 15:03:56.322 -> Got UDP! 15:03:56.322 -> :urd 254, 451, 0 15:03:56.322 -> :urch 479, 467 15:03:56.322 -> Got UDP! 15:03:56.322 -> :urd 254, 467, 0 15:03:56.322 -> :urch 495, 451 15:03:56.322 -> Got UDP! 15:03:56.357 -> :urd 254, 451, 0 15:03:56.357 -> :urn 449 15:03:56.357 -> Got UDP! 15:03:56.357 -> :urd 254, 449, 0 15:03:56.357 -> :urch 477, 396 15:03:56.357 -> Got UDP! 15:03:56.357 -> :urd 254, 396, 0 15:03:56.357 -> :urn 435 15:03:56.357 -> Got UDP! 15:03:56.357 -> :urd 254, 435, 0 15:03:56.357 -> :urn 396 15:03:56.357 -> Got UDP! 15:03:56.357 -> :urd 254, 396, 0 15:03:56.357 -> :urn 455 15:03:56.357 -> Got UDP! 15:03:56.357 -> :urd 254, 455, 0 15:03:56.357 -> :urch 483, 396 15:03:56.391 -> Got UDP! 15:03:56.391 -> :urd 254, 396, 0 15:03:56.391 -> :urch 424, 459 15:03:56.391 -> Got UDP! 15:03:56.391 -> :urd 254, 459, 0 15:03:56.427 -> :urn 387 15:03:56.427 -> Got UDP! 15:03:56.427 -> :urd 254, 387, 0 15:04:56.038 -> :urn 387 15:04:56.038 -> Got UDP! 15:04:56.038 -> :urd 254, 387, 0 15:04:56.221 -> :urn 396 15:04:56.221 -> Got UDP! 15:04:56.221 -> :urd 254, 396, 0 15:04:56.221 -> :urch 424, 455 15:04:56.221 -> Got UDP! 15:04:56.221 -> :urd 254, 455, 0 15:04:56.221 -> :urch 483, 396 15:04:56.259 -> Got UDP! 15:04:56.259 -> :urd 254, 396, 0 15:04:56.259 -> :urch 424, 459 15:04:56.259 -> Got UDP! 15:04:56.259 -> :urd 254, 459, 0 15:04:56.259 -> :urch 487, 387 15:04:56.259 -> Got UDP! 15:04:56.259 -> :urd 254, 387, 0 15:04:56.259 -> :urch 415, 451 15:04:56.259 -> Got UDP! 15:04:56.259 -> :urd 254, 451, 0 15:04:56.259 -> :urch 479, 396 15:04:56.259 -> Got UDP! 15:04:56.259 -> :urd 254, 396, 0 15:04:56.259 -> :urn 449 15:04:56.259 -> Got UDP! 15:04:56.259 -> :urd 254, 449, 0 15:04:56.259 -> :urch 477, 435 15:04:56.259 -> Got UDP! 15:04:56.295 -> :urd 254, 435, 0 15:04:56.295 -> :urch 463, 451 15:04:56.295 -> Got UDP! 15:04:56.295 -> :urd 254, 451, 0 15:05:04.609 -> :urn 174 15:05:04.609 -> Got UDP! 15:05:04.609 -> :urd 174, 174, 0 15:05:04.647 -> M-SEARCH HTTP/1.1 15:05:04.647 -> HOST: 239.255.255.250:1900 15:05:04.647 -> MAN: "ssdp:discover" 15:05:04.647 -> MX: 1 15:05:04.647 -> ST: urn:dial-multiscreen-org:service:dial:1 15:05:04.647 -> USER-AGENT: Google Chrome/86.0.4240.75 Mac OS X 15:05:04.647 -> 15:05:04.647 -> 15:05:05.662 -> :urn 174 15:05:05.662 -> Got UDP! 15:05:05.662 -> :urd 174, 174, 0 15:05:05.662 -> M-SEARCH HTTP/1.1 15:05:05.662 -> HOST: 239.255.255.250:1900 15:05:05.662 -> MAN: "ssdp:discover" 15:05:05.662 -> MX: 1 15:05:05.662 -> ST: urn:dial-multiscreen-org:service:dial:1 15:05:05.662 -> USER-AGENT: Google Chrome/86.0.4240.75 Mac OS X 15:05:05.662 -> 15:05:05.662 -> 15:05:06.669 -> :urn 174 15:05:06.669 -> Got UDP! 15:05:06.669 -> :urd 174, 174, 0 15:05:06.669 -> M-SEARCH HTTP/1.1 15:05:06.669 -> HOST: 239.255.255.250:1900 15:05:06.669 -> MAN: "ssdp:discover" 15:05:06.703 -> MX: 1 15:05:06.703 -> ST: urn:dial-multiscreen-org:service:dial:1 15:05:06.703 -> USER-AGENT: Google Chrome/86.0.4240.75 Mac OS X 15:05:06.703 -> 15:05:06.703 -> 15:05:07.682 -> :urn 174 15:05:07.682 -> Got UDP! 15:05:07.682 -> :urd 174, 174, 0 15:05:07.719 -> M-SEARCH * HTTP/1.1 15:05:07.719 -> HOST: 239.255.255.250:1900 15:05:07.719 -> MAN: "ssdp:discover" 15:05:07.719 -> MX: 1 15:05:07.719 -> ST: urn:dial-multiscreen-org:service:dial:1 15:05:07.719 -> USER-AGENT: Google Chrome/86.0.4240.75 Mac OS X 15:05:07.719 -> 15:05:07.719 -> 15:05:56.022 -> :urn 387 15:05:56.022 -> Got UDP! 15:05:56.022 -> :urd 254, 387, 0 15:05:56.234 -> :urn 396 15:05:56.234 -> Got UDP! 15:05:56.234 -> :urd 254, 396, 0 15:05:56.234 -> :urch 424, 455 15:05:56.234 -> Got UDP! 15:05:56.234 -> :urd 254, 455, 0 15:05:56.234 -> :urch 483, 396 15:05:56.234 -> Got UDP! 15:05:56.234 -> :urd 254, 396, 0 15:05:56.234 -> :urch 424, 459 15:05:56.234 -> Got UDP! 15:05:56.272 -> :urd 254, 459, 0 15:05:56.272 -> :urch 487, 387 15:05:56.272 -> Got UDP! 15:05:56.272 -> :urd 254, 387, 0 15:05:56.272 -> :urch 415, 467 15:05:56.272 -> Got UDP! 15:05:56.272 -> :urd 254, 467, 0 15:05:56.272 -> :urn 451 15:05:56.272 -> Got UDP! 15:05:56.272 -> :urd 254, 451, 0 15:05:56.272 -> :urch 479, 449 15:05:56.272 -> Got UDP! 15:05:56.272 -> :urd 254, 449, 0 15:05:56.272 -> :urch 477, 396 15:05:56.272 -> Got UDP! 15:05:56.272 -> :urd 254, 396, 0 15:05:56.272 -> :urn 435 15:05:56.272 -> Got UDP! 15:05:56.306 -> :urd 254, 435, 0 15:05:56.340 -> :urn 451 15:05:56.340 -> Got UDP! 15:05:56.340 -> :urd 254, 451, 0

phani87 commented 3 years ago

does it not work with Alexa App on phone ?

Aircoookie commented 3 years ago

Hi, no, you still need a physical echo device on the same network as the ESP8266 unfortunately. Thank you for the log, it indicates that there was no call made to the Philips Hue API which Espalexa emulates.