vintlabs / fauxmoESP

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

Devices not discovering with Echo Gen 2 Devices #84

Closed pvint closed 5 years ago

pvint commented 5 years ago

Original report by ThorC (Bitbucket: thorlucasdev, ).


Hi, I used this library some time ago and found some issues with Echo Gen 2. devices. After opening an issue and doing some trouble shooting, I was able to get it working. This was back when the library emulated WeMo devices.

Now that the library is emulating Phillips Hue devices, my Gen. 2 Echo dots are not able to discover the devices.

#include <Arduino.h>
#include <ESP8266WiFi.h>
#include "fauxmoESP.h"

#define WIFI_SSID "..."
#define WIFI_PWD "..."

fauxmoESP fauxmo;
const int outputPins[4] = {D1, D2, D3, D4};

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

  WiFi.mode(WIFI_STA);

  Serial.printf("[WIFI] Connecting to %s", WIFI_SSID);
  WiFi.begin(WIFI_SSID, WIFI_PWD);

  while (WiFi.status() != WL_CONNECTED) {
    Serial.print(".");
    delay(100);
  }
  Serial.printf("\n");

  Serial.printf("[WIFI] Station mode, SSID: %s, IP: %s\n", WiFi.SSID().c_str(), WiFi.localIP().toString().c_str());

    for (int i = 0; i < 4; ++i) {
        pinMode(outputPins[i], OUTPUT);
    }

    fauxmo.addDevice("big lamp");
    fauxmo.addDevice("small lamp");
    fauxmo.addDevice("switch one");
    fauxmo.addDevice("switch two");

  Serial.printf("Added devices\n");

    fauxmo.onSetState([](unsigned char device_id, const char* device_name, bool state, unsigned char value) {
        Serial.printf("[MAIN] Device #%d (%s) state: %s value: %d\n", device_id, device_name, state ? "ON" : "OFF", value);
    });

  fauxmo.setPort(80);
    fauxmo.enable(true);

  Serial.printf("Enabled fauxmo\n");
}

void loop() {
    fauxmo.handle();
}

Both the Echo Dot and the ESP8266 are connecting on 2.4 GHz wifi.

pvint commented 5 years ago

Original comment by ThorC (Bitbucket: thorlucasdev, ).


After doing some testing, it appears that v3.0.0 broke support for Gen2 devices. Prior builds (up to 2.4.4) were tested and worked.

pvint commented 5 years ago

Original comment by Carlos Yz (Bitbucket: [Carlos Yamazaki](https://bitbucket.org/Carlos Yamazaki), ).


Check lwIP option - 'v1.4 Higher Bandwidth'. It worked for me, like said in Issue #58. But esp8266 core 2.5.0 Beta 1 and 2, the v1.4 has some bug. Try 2.5.0 non-Beta instead of Beta 3. Someone said v2.0 Higher Bandwidth has some bug too. I use only Echo Dot 2 and fauxmo 3.1.0 is ok.

pvint commented 5 years ago

Original comment by ThorC (Bitbucket: thorlucasdev, ).


@CarlosYz I have been using ESP core 2.3.0 for these tests, as that was the last version that previously worked with me. I will try 2.5.0 non-beta with 3.1.0 fauxmo and higher bandwidth.

pvint commented 5 years ago

Original comment by ThorC (Bitbucket: thorlucasdev, ).


@CarlosYz it works! Thank you.

pvint commented 5 years ago

Original comment by ThorC (Bitbucket: thorlucasdev, ).


Thanks to @CarlosYz, the answer is setting "Higher Bandwidth" mode. Both v1.4 and v2 work for me. Thanks!