Aircoookie / Espalexa

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

No detection Sonos One #206

Open dasch3a opened 2 years ago

dasch3a commented 2 years ago

Hello there,

I got a problem detecting my esp8266 in the alexa app. I'm using my Sonos One for Alexa. Could this be the main Problem or is it working for sombody else?

My Code:

`#ifdef Arduino_Arch_ESP8266
#include <WiFi.h>
#else
#include <ESP8266WiFi.h>
#endif
#define ESPALEXA_MAXDEVICES 10
#define ESPALEXA_DEBUG
#include <Espalexa.h>

boolean connectWifi();

void Ambientebeleuchtung(byte Helligkeit);

const char* ssid = "XXX";
const char* password = "XXX";

boolean wifiConnected = false;

Espalexa espalexa;

void setup() {

  Serial.begin(115200);
  wifiConnected = connectWifi();

  if(wifiConnected){

    espalexa.addDevice("Ambientebeleuchtung", Ambientebeleuchtung, 127);

    espalexa.begin();

    } else
    {

      while(1){

        Serial.println("Wlanverbindung nicht hergestellt.");
        delay(2500);

        }
    }
}

void loop() {

  espalexa.loop();
  delay(1);

}

void Ambientebeleuchtung(byte Helligkeit) {

  const int ledPin = 13;

  if (Helligkeit) {

    analogWrite(ledPin, Helligkeit);
    Serial.print("An, Helligkeit");
    Serial.println(Helligkeit);

   }
}

boolean connectWifi(){

  boolean state = true;
  int i = 0;

  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  Serial.println("");
  Serial.println("Wlan-Verbindung herstellen");

  Serial.print("Verbinden...");
  while (WiFi.status() != WL_CONNECTED){
    delay(500);
    Serial.print(".");
    if ( i > 30) {
      state = false; break;
    }
    i++;
  }
  Serial.println("");
  if (state){
    Serial.print("Verbunden mit ");
    Serial.println(ssid);
    Serial.print("IP Adresse: ");
    Serial.println(WiFi.localIP());
  }
  else {
    Serial.println("Verbindung fehlgeschlagen");
  }
  return state;
}`
`22:58:28.499 -> ...........................
22:58:42.205 -> Verbunden mit XXX
22:58:42.205 -> IP Adresse: 192.168.178.85
22:58:42.205 -> Constructing device 1
22:58:42.205 -> Adding device 1
22:58:42.205 -> Espalexa Begin...
22:58:42.205 -> MAXDEVICES 10
22:58:42.253 -> Done
22:58:44.554 -> Got UDP!
22:58:44.554 -> M-SEARCH * HTTP/1.1
22:58:44.554 -> HOST: 239.255.255.250:1900
22:58:44.554 -> MAN: "ssdp:discover"
22:58:44.554 -> MX: 1
22:58:44.554 -> ST: urn:dial-multiscreen-org:service:dial:1
22:58:44.554 -> USER-AGENT: Chromium/100.0.4896.127 Windows
22:58:44.554 -> 
22:58:44.554 -> 
22:58:45.555 -> Got UDP!
22:58:45.555 -> M-SEARCH * HTTP/1.1
22:58:45.555 -> HOST: 239.255.255.250:1900
22:58:45.555 -> MAN: "ssdp:discover"
22:58:45.555 -> MX: 1
22:58:45.555 -> ST: urn:dial-multiscreen-org:service:dial:1
22:58:45.555 -> USER-AGENT: Chromium/100.0.4896.127 Windows
22:58:45.555 -> 
22:58:45.555 -> 
22:58:46.595 -> Got UDP!
22:58:46.595 -> M-SEARCH * HTTP/1.1
22:58:46.595 -> HOST: 239.255.255.250:1900
22:58:46.595 -> MAN: "ssdp:discover"
22:58:46.595 -> MX: 1
22:58:46.595 -> ST: urn:dial-multiscreen-org:service:dial:1
22:58:46.595 -> USER-AGENT: Chromium/100.0.4896.127 Windows
22:58:46.595 -> 
22:58:46.595 -> 
22:58:47.498 -> Got UDP!
22:58:47.498 -> M-SEARCH * HTTP/1.1
22:58:47.498 -> HOST: 239.255.255.250:1900
22:58:47.498 -> MAN: "ssdp:discover"
22:58:47.498 -> MX: 1
22:58:47.498 -> ST: urn:dial-multiscreen-org:service:dial:1
22:58:47.498 -> USER-AGENT: Chromium/100.0.4896.127 Windows
22:58:47.498 -> 
22:58:47.498 -> 
22:58:48.026 -> Got UDP!
22:58:48.026 -> Got UDP!
22:58:58.050 -> Got UDP!
22:58:58.050 -> M-SEARCH * HTTP/1.1
22:58:58.050 -> HOST: 239.255.255.250:1900
22:58:58.050 -> MAN: "ssdp:discover"
22:58:58.050 -> MX: 1
22:58:58.050 -> ST: urn:dial-multiscreen-org:service:dial:1
22:58:58.050 -> USER-AGENT: Microsoft Edge/101.0.1210.47 Windows
22:58:58.050 -> 
22:58:58.050 -> 
22:58:59.090 -> Got UDP!
22:58:59.090 -> M-SEARCH * HTTP/1.1
22:58:59.090 -> HOST: 239.255.255.250:1900
22:58:59.090 -> MAN: "ssdp:discover"
22:58:59.090 -> MX: 1
22:58:59.090 -> ST: urn:dial-multiscreen-org:service:dial:1
22:58:59.090 -> USER-AGENT: Microsoft Edge/101.0.1210.47 Windows
22:58:59.090 -> 
22:58:59.090 -> 
22:59:00.077 -> Got UDP!
22:59:00.077 -> M-SEARCH * HTTP/1.1
22:59:00.077 -> HOST: 239.255.255.250:1900
22:59:00.077 -> MAN: "ssdp:discover"
22:59:00.077 -> MX: 1
22:59:00.077 -> ST: urn:dial-multiscreen-org:service:dial:1
22:59:00.124 -> USER-AGENT: Microsoft Edge/101.0.1210.47 Windows
22:59:00.124 -> 
22:59:00.124 -> 
22:59:01.107 -> Got UDP!
22:59:01.107 -> M-SEARCH * HTTP/1.1
22:59:01.107 -> HOST: 239.255.255.250:1900
22:59:01.107 -> MAN: "ssdp:discover"
22:59:01.107 -> MX: 1
22:59:01.107 -> ST: urn:dial-multiscreen-org:service:dial:1
22:59:01.107 -> USER-AGENT: Microsoft Edge/101.0.1210.47 Windows
22:59:01.155 -> 
22:59:01.155 -> 
22:59:12.983 -> Got UDP!
22:59:12.983 -> Got UDP!
22:59:13.220 -> Got UDP!
22:59:13.220 -> Got UDP!
22:59:13.508 -> Got UDP!
22:59:13.508 -> Got UDP!
22:59:19.268 -> Got UDP!
22:59:19.268 -> Got UDP!
`

Kind regards, David