Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP8266/ESP32 Not Found by Alexa #120

Closed
lightbulb14 opened this issue Oct 27, 2020 · 118 comments
Closed

ESP8266/ESP32 Not Found by Alexa #120

lightbulb14 opened this issue Oct 27, 2020 · 118 comments
Assignees
Labels

Comments

@lightbulb14
Copy link

Hi All,
I'm trying to get FauxmoESP running on an ESP8266 with my Alexa and am having some troubles. The sample sketch compiles and appears to run alright (it connects to my home network) but when I try to discover via the Alexa app no new devices are found. Below is my configuration:

Alexa: Amazon Fire TV Cube (2nd Gen I think), connected to router via ethernet cable.
Board: Adafruit Huzzah ESP8266 Breakout, connected to 2.4GHz WiFi
Arduino IDE 1.8.13 (Windows Store 1.8.42.0)
ESP8266 Core: 2.4.2 (also tried 2.7.4 with no luck)
FauxmoESP V3.1.1
ESPAsyncTCP current as of 10/26/2020
lwIP variant set to "v1.4 Higher Bandwidth"
For code, I started the sample fauxmoESP_Basic. I added #define DEBUG_FAUXMO Serial and removed 3/5 devices based on other peoples issues. Below is the serial output.

SDK:2.2.1(cfd48f3)/Core:2.4.2/lwIP:1.4.0rc2/BearSSL:6d1cefc      
[WIFI] Connecting to WiFi_SSID scandone      
..scandone      
state: 0 -> 2 (b0)      
state: 2 -> 3 (0)      
state: 3 -> 5 (10)      
add 0      
aid 4      
cnt       
connected with WiFi_SSID, channel 11      
dhcp client start...      
..................ip:192.168.1.241,mask:255.255.255.0,gw:192.168.1.1      
[WIFI] STATION Mode, SSID: WiFi_SSID, IP address: 192.168.1.241      
[MAIN] Free heap: 48464 bytes      
pm open,type:2 0      
[MAIN] Free heap: 47944 bytes      
[MAIN] Free heap: 47944 bytes      
[MAIN] Free heap: 47944 bytes      
[MAIN] Free heap: 47944 bytes

Thank you for any advice,
Lightbulb14

Source Code:

#include <Arduino.h>
#ifdef ESP32
    #include <WiFi.h>
#else
    #include <ESP8266WiFi.h>
#endif
#include "fauxmoESP.h"

// Rename the credentials.sample.h file to credentials.h and 
// edit it according to your router configuration
#include "credentials.h"

fauxmoESP fauxmo;

// -----------------------------------------------------------------------------

#define SERIAL_BAUDRATE     115200

#define LED_YELLOW          4
#define LED_GREEN           5


#define ID_YELLOW           "yellow lamp"
#define ID_GREEN            "green lamp"


#define DEBUG_FAUXMO Serial

// -----------------------------------------------------------------------------

// -----------------------------------------------------------------------------
// Wifi
// -----------------------------------------------------------------------------

void wifiSetup() {

    // Set WIFI module to STA mode
    WiFi.mode(WIFI_STA);

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

    // Wait
    while (WiFi.status() != WL_CONNECTED) {
        Serial.print(".");
        delay(100);
    }
    Serial.println();

    // Connected!
    Serial.printf("[WIFI] STATION Mode, SSID: %s, IP address: %s\n", WiFi.SSID().c_str(), WiFi.localIP().toString().c_str());

}

void setup() {

    // Init serial port and clean garbage
    Serial.begin(SERIAL_BAUDRATE);
    Serial.println();
    Serial.println();

    // LEDs
    pinMode(LED_YELLOW, OUTPUT);
    pinMode(LED_GREEN, OUTPUT);

    digitalWrite(LED_YELLOW, LOW);
    digitalWrite(LED_GREEN, LOW);


    // Wifi
    wifiSetup();

    // By default, fauxmoESP creates it's own webserver on the defined port
    // The TCP port must be 80 for gen3 devices (default is 1901)
    // This has to be done before the call to enable()
    fauxmo.createServer(true); // not needed, this is the default value
    fauxmo.setPort(80); // This is required for gen3 devices

    // You have to call enable(true) once you have a WiFi connection
    // You can enable or disable the library at any moment
    // Disabling it will prevent the devices from being discovered and switched
    fauxmo.enable(true);

    // You can use different ways to invoke alexa to modify the devices state:
    // "Alexa, turn yellow lamp on"
    // "Alexa, turn on yellow lamp
    // "Alexa, set yellow lamp to fifty" (50 means 50% of brightness, note, this example does not use this functionality)

    // Add virtual devices
    fauxmo.addDevice(ID_YELLOW);
    fauxmo.addDevice(ID_GREEN);


    fauxmo.onSetState([](unsigned char device_id, const char * device_name, bool state, unsigned char value) {
        
        // Callback when a command from Alexa is received. 
        // You can use device_id or device_name to choose the element to perform an action onto (relay, LED,...)
        // State is a boolean (ON/OFF) and value a number from 0 to 255 (if you say "set kitchen light to 50%" you will receive a 128 here).
        // Just remember not to delay too much here, this is a callback, exit as soon as possible.
        // If you have to do something more involved here set a flag and process it in your main loop.
        
        Serial.printf("[MAIN] Device #%d (%s) state: %s value: %d\n", device_id, device_name, state ? "ON" : "OFF", value);

        // Checking for device_id is simpler if you are certain about the order they are loaded and it does not change.
        // Otherwise comparing the device_name is safer.

        if (strcmp(device_name, ID_YELLOW)==0) {
            digitalWrite(LED_YELLOW, state ? HIGH : LOW);
        } else if (strcmp(device_name, ID_GREEN)==0) {
            digitalWrite(LED_GREEN, state ? HIGH : LOW);
        } 

    });

}

void loop() {

    // fauxmoESP uses an async TCP server but a sync UDP server
    // Therefore, we have to manually poll for UDP packets
    fauxmo.handle();

    // This is a sample code to output free heap every 5 seconds
    // This is a cheap way to detect memory leaks
    static unsigned long last = millis();
    if (millis() - last > 5000) {
        last = millis();
        Serial.printf("[MAIN] Free heap: %d bytes\n", ESP.getFreeHeap());
    }

    // If your device state is changed by any other means (MQTT, physical button,...)
    // you can instruct the library to report the new state to Alexa on next request:
    // fauxmo.setState(ID_YELLOW, true, 255);

}
@cyyamazaki
Copy link

cyyamazaki commented Oct 27, 2020

My echo dots 2nd gen also are not detecting the esp8266. Last week they were ok.

Since the last update, last week, 658656720, detection stoped to work, but i tried the 2.4.4 version and it is ok (wemo version).

I'm brazilian and my echo dots can't be hacked to support portuguese anymore, since the same update.

The detected esps are still working, but i must not exclude them, anymore.

@ddweber456
Copy link

My echo dot 3rd gen and 2nd gen have also stopped discovering new Alexa devices with my ESP8266 D1 mini 12F. I started seeing issues about 3 weeks ago, sorry I don't remember the exact time I first saw the problem. Previously echo discovered devices still worked just fine and appeared to be very stable. It has been just the new builds and devices that Alexa refuses to discover.

Using 2.7.1
FauxmoESP 3.1.1 (also saw the same issue with 3.1.0)

I have found a trick to get Alexa to discover the new devices with 3.1.1. If I power off/on my echo dot 3rd gen, alexa will discover the new devices. In fact, alexa discovered old smart home devices that were at one time connected to my network but at the time of the latest discovery, after the power off/on. Those devices at the time of the latest discovery were not connected to my network and apparently were never REMOVED from the Alexa app. The echo will only do 1 successful discovery per power off/on cycle.

I have not tried the power off/on with the echo 2nd gen.

Obviously this is not a solution but I am hoping this might help someone smarter than me figure out what is going on.

Let me know if I can provide additional information.

@Freddy0031
Copy link

Confirming 2nd gen power on / off works, too...

I have had a similar problem. My code was running perfectly on ESP8266 and using FauxmoESP 3.1.0 some 7 months ago. Didn't do the device discovery for a while and was unable to get it work. It seems the FauxmoESP library was running fine as I was able to control ESP devices with the android app called Lampshade, but Alexa wouldn't discover any new devices.

It worked for me when removing all devices and unplugging my echo dot. After reboot, my echo dot 2nd gen discovered the devices and is able to control them perfectly. I can confirm what ddweber said above. I got some old devices listed, too, for whatever reason, but the main point is that it seems the echo will only do 1 successful discovery per power off/on cycle.

@pvint
Copy link
Member

pvint commented Nov 3, 2020

I can confirm that I'm having issues with this now too. Working on it and will report back.

@pvint
Copy link
Member

pvint commented Nov 3, 2020

(Edit: This is on ESP32 - I haven't tested on ESP8266, but it appears to be the same issue)

I've been experimenting a bit, and it seems as though the Echo does not like the response from Fauxmo, presently. (gen 2 and gen 3 behaving the same)

I'll have to look at this more tomorrow. Leaving a debug dump from a discover with one fauxmo device. (Edit: Discover was run from a Gen 2, in case it turns out to matter)

Paul

Debug dump of discovery
[MAIN] Free heap: 255768 bytes
[FAUXMO] UDP packet received
M-SEARCH * HTTP/1.1
HOST: 239.255.255.250:1900
ST: ssdp:all
MAN: "ssdp:discover"
MX: 3

[FAUXMO] Responding to M-SEARCH request
[FAUXMO] UDP response sent to 192.168.1.6:50000
HTTP/1.1 200 OK
EXT:
CACHE-CONTROL: max-age=100
LOCATION: http://192.168.1.15:80/description.xml
SERVER: FreeRTOS/6.0.5, UPnP/1.0, IpBridge/1.17.0
hue-bridgeid: cc50e3b7a5d8
ST: urn:schemas-upnp-org:device:basic:1
USN: uuid:2f402f80-da50-11e1-9b23-cc50e3b7a5d8::upnp:rootdevice

[FAUXMO] UDP packet received
M-SEARCH * HTTP/1.1
HOST: 239.255.255.250:1900
ST: upnp:rootdevice
MAN: "ssdp:discover"
MX: 3

[FAUXMO] Responding to M-SEARCH request
[FAUXMO] UDP response sent to 192.168.1.6:50000
HTTP/1.1 200 OK
EXT:
CACHE-CONTROL: max-age=100
LOCATION: http://192.168.1.15:80/description.xml
SERVER: FreeRTOS/6.0.5, UPnP/1.0, IpBridge/1.17.0
hue-bridgeid: cc50e3b7a5d8
ST: urn:schemas-upnp-org:device:basic:1
USN: uuid:2f402f80-da50-11e1-9b23-cc50e3b7a5d8::upnp:rootdevice

[FAUXMO] UDP packet received
M-SEARCH * HTTP/1.1
HOST: 239.255.255.250:1900
ST: ssdp:all
MAN: "ssdp:discover"
MX: 3

[FAUXMO] Responding to M-SEARCH request
[FAUXMO] UDP response sent to 192.168.1.6:50000
HTTP/1.1 200 OK
EXT:
CACHE-CONTROL: max-age=100
LOCATION: http://192.168.1.15:80/description.xml
SERVER: FreeRTOS/6.0.5, UPnP/1.0, IpBridge/1.17.0
hue-bridgeid: cc50e3b7a5d8
ST: urn:schemas-upnp-org:device:basic:1
USN: uuid:2f402f80-da50-11e1-9b23-cc50e3b7a5d8::upnp:rootdevice

[FAUXMO] UDP packet received
M-SEARCH * HTTP/1.1
HOST: 239.255.255.250:1900
ST: upnp:rootdevice
MAN: "ssdp:discover"
MX: 3

[FAUXMO] Responding to M-SEARCH request
[FAUXMO] UDP response sent to 192.168.1.6:50000
HTTP/1.1 200 OK
EXT:
CACHE-CONTROL: max-age=100
LOCATION: http://192.168.1.15:80/description.xml
SERVER: FreeRTOS/6.0.5, UPnP/1.0, IpBridge/1.17.0
hue-bridgeid: cc50e3b7a5d8
ST: urn:schemas-upnp-org:device:basic:1
USN: uuid:2f402f80-da50-11e1-9b23-cc50e3b7a5d8::upnp:rootdevice

[FAUXMO] UDP packet received
M-SEARCH * HTTP/1.1
HOST: 239.255.255.250:1900
ST: ssdp:all
MAN: "ssdp:discover"
MX: 3

[FAUXMO] Responding to M-SEARCH request
[FAUXMO] UDP response sent to 192.168.1.6:50000
HTTP/1.1 200 OK
EXT:
CACHE-CONTROL: max-age=100
LOCATION: http://192.168.1.15:80/description.xml
SERVER: FreeRTOS/6.0.5, UPnP/1.0, IpBridge/1.17.0
hue-bridgeid: cc50e3b7a5d8
ST: urn:schemas-upnp-org:device:basic:1
USN: uuid:2f402f80-da50-11e1-9b23-cc50e3b7a5d8::upnp:rootdevice

[FAUXMO] UDP packet received
M-SEARCH * HTTP/1.1
HOST: 239.255.255.250:1900
ST: upnp:rootdevice
MAN: "ssdp:discover"
MX: 3

[FAUXMO] Responding to M-SEARCH request
[FAUXMO] UDP response sent to 192.168.1.6:50000
HTTP/1.1 200 OK
EXT:
CACHE-CONTROL: max-age=100
LOCATION: http://192.168.1.15:80/description.xml
SERVER: FreeRTOS/6.0.5, UPnP/1.0, IpBridge/1.17.0
hue-bridgeid: cc50e3b7a5d8
ST: urn:schemas-upnp-org:device:basic:1
USN: uuid:2f402f80-da50-11e1-9b23-cc50e3b7a5d8::upnp:rootdevice

[FAUXMO] UDP packet received
M-SEARCH * HTTP/1.1
HOST: 239.255.255.250:1900
ST: ssdp:all
MAN: "ssdp:discover"
MX: 3

[FAUXMO] Responding to M-SEARCH request
[FAUXMO] UDP response sent to 192.168.1.9:50000
HTTP/1.1 200 OK
EXT:
CACHE-CONTROL: max-age=100
LOCATION: http://192.168.1.15:80/description.xml
SERVER: FreeRTOS/6.0.5, UPnP/1.0, IpBridge/1.17.0
hue-bridgeid: cc50e3b7a5d8
ST: urn:schemas-upnp-org:device:basic:1
USN: uuid:2f402f80-da50-11e1-9b23-cc50e3b7a5d8::upnp:rootdevice

[FAUXMO] UDP packet received
M-SEARCH * HTTP/1.1
HOST: 239.255.255.250:1900
ST: upnp:rootdevice
MAN: "ssdp:discover"
MX: 3

[FAUXMO] Responding to M-SEARCH request
[FAUXMO] UDP response sent to 192.168.1.9:50000
HTTP/1.1 200 OK
EXT:
CACHE-CONTROL: max-age=100
LOCATION: http://192.168.1.15:80/description.xml
SERVER: FreeRTOS/6.0.5, UPnP/1.0, IpBridge/1.17.0
hue-bridgeid: cc50e3b7a5d8
ST: urn:schemas-upnp-org:device:basic:1
USN: uuid:2f402f80-da50-11e1-9b23-cc50e3b7a5d8::upnp:rootdevice

[FAUXMO] UDP packet received
M-SEARCH * HTTP/1.1
HOST: 239.255.255.250:1900
ST: upnp:rootdevice
MAN: "ssdp:discover"
MX: 3

[FAUXMO] Responding to M-SEARCH request
[FAUXMO] UDP response sent to 192.168.1.9:50000
HTTP/1.1 200 OK
EXT:
CACHE-CONTROL: max-age=100
LOCATION: http://192.168.1.15:80/description.xml
SERVER: FreeRTOS/6.0.5, UPnP/1.0, IpBridge/1.17.0
hue-bridgeid: cc50e3b7a5d8
ST: urn:schemas-upnp-org:device:basic:1
USN: uuid:2f402f80-da50-11e1-9b23-cc50e3b7a5d8::upnp:rootdevice

[FAUXMO] Client #0 connected
[FAUXMO] TCP request
GET /description.xml HTTP/1.1
Host: 192.168.1.15
Accept: */*
Content-Type: application/json


[FAUXMO] isGet: true
[FAUXMO] URL: /description.xml
[FAUXMO] Handling /description.xml request
[FAUXMO] Response:
HTTP/1.1 200 OK
Content-Type: text/xml
Content-Length: 763
Connection: close

<?xml version="1.0" ?><root xmlns="urn:schemas-upnp-org:device-1-0"><specVersion><major>1</major><minor>0</minor></specVersion><URLBase>http://192.168.1.15:80/</URLBase><device><deviceType>urn:schemas-upnp-org:device:Basic:1</deviceType><friendlyName>Philips hue (192.168.1.15:80)</friendlyName><manufacturer>Royal Philips Electronics</manufacturer><manufacturerURL>http://www.philips.com</manufacturerURL><modelDescription>Philips hue Personal Wireless Lighting</modelDescription><modelName>Philips hue bridge 2012</modelName><modelNumber>929000226503</modelNumber><modelURL>http://www.meethue.com</modelURL><serialNumber>cc50e3b7a5d8</serialNumber><UDN>uuid:2f402f80-da50-11e1-9b23-cc50e3b7a5d8</UDN><presentationURL>index.html</presentationURL></device></root>
[FAUXMO] Client #0 disconnected
[FAUXMO] Client #0 connected
[FAUXMO] TCP request
GET /api/2WLEDHardQrI3WHYTHoMcXHgEspsM8ZZRpSKtBQr/lights HTTP/1.1
Host: 192.168.1.15
Accept: */*
Content-Type: application/json


[FAUXMO] isGet: true
[FAUXMO] URL: /api/2WLEDHardQrI3WHYTHoMcXHgEspsM8ZZRpSKtBQr/lights
[FAUXMO] Handling list request
[FAUXMO] Response:
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 270
Connection: close

{"1":{"type":"Extended Color Light","name":"yellow lamp","uniqueid":"cc50e3b7a5d8-1","modelid":"LCT007","state":{"on":false,"bri":0,"xy":[0,0],"reachable": true},"capabilities":{"certified":false,"streaming":{"renderer":true,"proxy":false}},"swversion":"5.105.0.21169"}}
[FAUXMO] Client #0 disconnected
[FAUXMO] Client #0 connected
[FAUXMO] TCP request
GET /api/2WLEDHardQrI3WHYTHoMcXHgEspsM8ZZRpSKtBQr/lights/1 HTTP/1.1
Host: 192.168.1.15
Accept: */*
Content-Type: application/json


[FAUXMO] isGet: true
[FAUXMO] URL: /api/2WLEDHardQrI3WHYTHoMcXHgEspsM8ZZRpSKtBQr/lights/1
[FAUXMO] Handling list request
[FAUXMO] Response:
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 264
Connection: close

{"type":"Extended Color Light","name":"yellow lamp","uniqueid":"cc50e3b7a5d8-1","modelid":"LCT007","state":{"on":false,"bri":0,"xy":[0,0],"reachable": true},"capabilities":{"certified":false,"streaming":{"renderer":true,"proxy":false}},"swversion":"5.105.0.21169"}
[FAUXMO] Client #0 disconnected
[FAUXMO] Client #0 connected
[FAUXMO] TCP request
GET /api/2WLEDHardQrI3WHYTHoMcXHgEspsM8ZZRpSKtBQr/lights HTTP/1.1
Host: 192.168.1.15
Accept: */*
Content-Type: application/json


[FAUXMO] isGet: true
[FAUXMO] URL: /api/2WLEDHardQrI3WHYTHoMcXHgEspsM8ZZRpSKtBQr/lights
[FAUXMO] Handling list request
[FAUXMO] Response:
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 270
Connection: close

{"1":{"type":"Extended Color Light","name":"yellow lamp","uniqueid":"cc50e3b7a5d8-1","modelid":"LCT007","state":{"on":false,"bri":0,"xy":[0,0],"reachable": true},"capabilities":{"certified":false,"streaming":{"renderer":true,"proxy":false}},"swversion":"5.105.0.21169"}}
[FAUXMO] Client #0 disconnected
[FAUXMO] Client #0 connected
[FAUXMO] TCP request
GET /description.xml HTTP/1.1
Host: 192.168.1.15
Accept: */*
Content-Type: application/json


[FAUXMO] isGet: true
[FAUXMO] URL: /description.xml
[FAUXMO] Handling /description.xml request
[FAUXMO] Response:
HTTP/1.1 200 OK
Content-Type: text/xml
Content-Length: 763
Connection: close

<?xml version="1.0" ?><root xmlns="urn:schemas-upnp-org:device-1-0"><specVersion><major>1</major><minor>0</minor></specVersion><URLBase>http://192.168.1.15:80/</URLBase><device><deviceType>urn:schemas-upnp-org:device:Basic:1</deviceType><friendlyName>Philips hue (192.168.1.15:80)</friendlyName><manufacturer>Royal Philips Electronics</manufacturer><manufacturerURL>http://www.philips.com</manufacturerURL><modelDescription>Philips hue Personal Wireless Lighting</modelDescription><modelName>Philips hue bridge 2012</modelName><modelNumber>929000226503</modelNumber><modelURL>http://www.meethue.com</modelURL><serialNumber>cc50e3b7a5d8</serialNumber><UDN>uuid:2f402f80-da50-11e1-9b23-cc50e3b7a5d8</UDN><presentationURL>index.html</presentationURL></device></root>
[FAUXMO] Client #0 disconnected
[FAUXMO] Client #0 connected
[FAUXMO] TCP request
GET /api/2WLEDHardQrI3WHYTHoMcXHgEspsM8ZZRpSKtBQr/lights HTTP/1.1
Host: 192.168.1.15
Accept: */*
Content-Type: application/json


[FAUXMO] isGet: true
[FAUXMO] URL: /api/2WLEDHardQrI3WHYTHoMcXHgEspsM8ZZRpSKtBQr/lights
[FAUXMO] Handling list request
[FAUXMO] Response:
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 270
Connection: close

{"1":{"type":"Extended Color Light","name":"yellow lamp","uniqueid":"cc50e3b7a5d8-1","modelid":"LCT007","state":{"on":false,"bri":0,"xy":[0,0],"reachable": true},"capabilities":{"certified":false,"streaming":{"renderer":true,"proxy":false}},"swversion":"5.105.0.21169"}}
[FAUXMO] Client #0 disconnected
[FAUXMO] Client #0 connected
[FAUXMO] TCP request
GET /api/2WLEDHardQrI3WHYTHoMcXHgEspsM8ZZRpSKtBQr/lights/1 HTTP/1.1
Host: 192.168.1.15
Accept: */*
Content-Type: application/json


[FAUXMO] isGet: true
[FAUXMO] URL: /api/2WLEDHardQrI3WHYTHoMcXHgEspsM8ZZRpSKtBQr/lights/1
[FAUXMO] Handling list request
[FAUXMO] Response:
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 264
Connection: close

{"type":"Extended Color Light","name":"yellow lamp","uniqueid":"cc50e3b7a5d8-1","modelid":"LCT007","state":{"on":false,"bri":0,"xy":[0,0],"reachable": true},"capabilities":{"certified":false,"streaming":{"renderer":true,"proxy":false}},"swversion":"5.105.0.21169"}
[MAIN] Free heap: 252436 bytes
[FAUXMO] Client #0 disconnected
[FAUXMO] Client #0 connected
[FAUXMO] TCP request
GET /api/2WLEDHardQrI3WHYTHoMcXHgEspsM8ZZRpSKtBQr/lights HTTP/1.1
Host: 192.168.1.15
Accept: */*
Content-Type: application/json


[FAUXMO] isGet: true
[FAUXMO] URL: /api/2WLEDHardQrI3WHYTHoMcXHgEspsM8ZZRpSKtBQr/lights
[FAUXMO] Handling list request
[FAUXMO] Response:
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 270
Connection: close

{"1":{"type":"Extended Color Light","name":"yellow lamp","uniqueid":"cc50e3b7a5d8-1","modelid":"LCT007","state":{"on":false,"bri":0,"xy":[0,0],"reachable": true},"capabilities":{"certified":false,"streaming":{"renderer":true,"proxy":false}},"swversion":"5.105.0.21169"}}
[FAUXMO] Client #0 disconnected
[MAIN] Free heap: 255420 bytes
[MAIN] Free heap: 255420 bytes

@pvint
Copy link
Member

pvint commented Nov 4, 2020

I got mine to work this morning on a Gen 2 Echo Dot - I have not tested heavily yet, but I had noticed that a couple times when I discovered it found an old device that was not even online, so I went to Amazon and deleted device history, here:

Amazon ca: Manage Your Content and Devices - Google Chrome_067

Please go to https://www.amazon.ca/hz/mycd/myx#/home/alexaPrivacy/deviceHistory (substitute .com .de or whatever in the URL for your location) and try deleting smart home devices history and retry discovery. (I don't know if it's relevant, but I rebooted my Echo before trying discovery)

Let me know
Paul

@ddweber456
Copy link

Could this have something to do with the EOS (End Of Support) for the Hue Bridge V1?
https://www.philips-hue.com/en-gb/support/legal/end-of-support-policy#3

It looks like the Hue Bridge V2 is still supported, with no EOS at this time. Can FauxmoESP use V2?
https://www.theverge.com/circuitbreaker/2020/3/6/21167813/philips-hue-bridge-hub-internet-connectivity-discontinued-cloud-updates

@pvint pvint self-assigned this Nov 4, 2020
@pvint pvint added the critical label Nov 4, 2020
@pvint pvint changed the title ESP8266 Not Found by Alexa ESP8266/ESP32 Not Found by Alexa Nov 4, 2020
@ddweber456
Copy link

@pvint , have you had any luck figuring out fix for this? Can I assist with testing or anything?

@pvint
Copy link
Member

pvint commented Nov 6, 2020

@ddweber456 I sure can use some help testing! Can you let me know if my experience from two posts up works for you? ;)

Anyone else too - I really would love some feedback on whether that works for others. Due to a recent move I'm not using fauxmo "in production" at the moment, but testing tells me that it fixed the issue for me, and I would love confirmation.

@ddweber456
Copy link

@pvint Thanks for the reply. I did try the delete History in the Alexa Amazon app. That by itself did not make the discover new devices work. I can confirm that the power off/on of the Echo dot Gev3 does allow Alexa to find new devices but only one time per off/on cycle. I think it just a fluke that that the discover devices still works at all.

Maybe the real issue is the End of Support (EOS) for the Philip Hue Bridge 2012 the code is emulating. If I'm reading the 'templates.h' correctly, the JSON in the FAUXMO_DESCRIPTION_TEMPLATE[] is using the modelName and modelNumber of the Hue Bridge V1

"<modelName>Philips hue bridge 2012</modelName>" "<modelNumber>929000226503</modelNumber>"

The EOS for that Bridge was announced April 29, 2019 and was followed on by April 30, 2020 with no more updates to the Hue Bridge V1. See my posts of 2 days ago for the links to the EOS articles. About that time, April 2020, Amazon Alexa came out with a Gen 4 release with all their updates and just maybe FauxmoESP and the Hue Bridge V1 suffered in the aftermath.

FauxmoESP is not the only Library having this issue right now. Aircoookie/Espalexa https://github.com/Aircoookie/Espalexa is experiencing the same issues of NOT discovering new devices. It was thanks to @seriouz on Aircoookie/Espalexa that brought the EOS issue to my attention with his post on March 9, 2020.

Maybe we can use the Hue Bridge V2? I suspect the JSON format for the V2 is different than the V1.

I'm not going to be much help with the code, but I would be happy to help any other way.

@cyyamazaki
Copy link

cyyamazaki commented Nov 6, 2020

I´m not a good developer. But i was looking for hue v2 information and searching for "<modelName>Philips hue bridge" i found this project in python. I'll study this a little but I think there's a lot of better programmers than me here :): https://github.com/marcelveldt/hass_emulated_hue

@cyyamazaki
Copy link

@ddweber456 I sure can use some help testing! Can you let me know if my experience from two posts up works for you? ;)

Anyone else too - I really would love some feedback on whether that works for others. Due to a recent move I'm not using fauxmo "in production" at the moment, but testing tells me that it fixed the issue for me, and I would love confirmation.

On/Off procedure didn't work for me. Neither clean the History on Alexa App.

@ddweber456
Copy link

Looking for some help.

This is going to sound a little crazy. But here it goes.

After power off/on (reboot) of my Echo Dot Gen3, if I wait more than 30 sec to start the discover new devices, the discovery fails. If I start the discover new devices within 30 sec of Echo reboot, the discover work every time.

If someone else could validate this strang finding that would be GREAT.

@Freddy0031
Copy link

@ddweber456 Yes, timing seems to make a difference. I can confirm, it discovers after on/off only if doing discovery straight after reboot. After deleting all devices, and off/on, my Echo Dot 2G first round of discovery only detects the other Echos, but doesn't capture any response from FauxmoESP. Subsequently, a second round of off/on and quick discovery then picks up responses from FauxmoESP, but missing 1 device and still getting old devices.

Regarding the EOS for the Hue Bridge v1 back in April. This makes much sense to me and seems in line with timing of this problem for me. Things worked perfectly fine back in March and now my (unchanged) code causes issues with discovery. There must have been some change in the Alexa software during this time. However, my Android app Lampshade picks up all devices correctly and still works perfect with FauxmoESP.

@pvint Thanks for the idea with the smart home device history. I tried deleting all devices, deleting the history and doing the discovery. Still it lacks one new device and brings back some old device names. I feel less disturbed by the old devices than by not being able to discover the new ones.

I'm happy to do more testing or share insights, but my programming skills are very limited unfortunately.

@lightbulb14
Copy link
Author

lightbulb14 commented Nov 7, 2020

I'm new to the fauxmoESP/Alexa stuff and have never got it working. I enabled Smart Home by Sinet Technologies in Alexa, but is there any particular Smart Home Skill that needs to be enabled? I have a LIFX bulb that Alexa controls okay. I've tried going to Devices>Add Device>Other>Discover Devices but this has not worked. I've also asked Alexa verbally to "Discover new devices" and this has not worked either. I've tried both of these within 30 seconds of powering on. I also tried adding the fauxmoESP via the "Phillips Hue V1 bridge (Circular shape)" hub option with no luck.

I'd be glad to help test some more, but I'm a bit uneducated at the moment.

Thank you,
Lightbulb.

@Freddy0031
Copy link

@lightbulb14 , you don't need any alexa smart home skill to make alexa discover fauxmoesp/it's Hue Bridge. Just discover devices should be sufficient. Lately, it seems to discover only after reboot and by quickly triggering the discovery - at least for some of us here. You may want to give it a try to first delete your smarthome devices, then reboot and discover - potentially repeating the reboot and discover again. Once discovered it works fine, but it seems alexa discovery became a bit tricky recently.

@pvint
Copy link
Member

pvint commented Nov 7, 2020

I finally got a good chance to dig into this this morning, and I think we have something:

It seems as though Alexa isn't liking the "uniqueid" string we are sending (which is just the MAC of the ESP device with the device number appended, ie: AABBCCDDEEFF-01), and simply stripping the "-01" off seems to work.

I've applied the change in the https://github.com/vintlabs/fauxmoESP/tree/discoveryIssue branch, so please test it out and let me know if it's working for you. (Edit: The discoveryIssue branch has been merged to master)

For reference, the changes are:

In fauxmoESP.cpp, change line 127 from:

device.name, mac.c_str(),

To:

device.name, mac.substring(6).c_str(), id,

and change templates.h line 46 from:

"\"uniqueid\":\"%s-%d\","

To:

"\"uniqueid\":\"%s%06d\","

(EDIT: Updated the changes to reflect the newer commit)

I have gone through a few cycles of deleting and re-adding devices, testing control etc, and it seems to be working fine so far, however further testing is needed. Also note: I have only tested with Gen 2 so far, and I did not need to reboot the device.

@mcspr
Copy link

mcspr commented Nov 7, 2020 via email

@pvint
Copy link
Member

pvint commented Nov 7, 2020

@mcspr Thanks for pointing that out. It actually concurs with what I was thinking... that the "uniqueid" not actually being unique could cause other issues.

I tested using the MAC with the device number (ie: "%s%d", without the "-") and it was still presenting discovery issues. I will change it to use the last the octets of the MAC as pointed out above.

@pvint
Copy link
Member

pvint commented Nov 7, 2020

I have changed it to now use the last 3 bytes of the MAC plus a 6 digit device ID (it seems to only work with at 12 digit uniqueid).

Example: The MAC of my ESP is a4cf123373b8, so the first device has uniqueid of 3373b8000000, the second 3373b8000001, etc

@lightbulb14
Copy link
Author

lightbulb14 commented Nov 7, 2020

Thanks for the work everyone, but my Alexa is still unable to discover the fauxmoESP device. I downloaded the discoveryIssue branch and replaced the fauxmoESP.cpp and templates.h in my Arduino libraries folder with ones from the discoveryIssue download. Could me using an Amazon Fire Cube make a difference?

Also, the changes that pvint listed in the comment for templates.h should be changed to "\"uniqueid\":\"%s\","

@pvint
Copy link
Member

pvint commented Nov 7, 2020

Thanks for the work everyone, but my Alexa is still unable to discover the fauxmoESP device. I downloaded the discoveryIssue branch and replaced the fauxmoESP.cpp and templates.h in my Arduino libraries folder with ones from the discoveryIssue download. Could me using an Amazon Fire Cube make a difference?

@lightbulb14 I wouldn't think that using the fire cube would be an issue, but I don't have one to test.

Also, the changes that pvint listed in the comment for templates.h should be changed to "\"uniqueid\":\"%s\","

Thanks for pointing that out - I've updated that comment to reflect the latest change (commit eb9a055)

I'm curious to wait and see if others are having success with this change before we dig into your particular case too much, just in case it's an unrelated issue.

@Freddy0031
Copy link

@pvint - the code you placed in the discoveryissue branch works for me. Great. Many thanks. Discovery worked without alexa reboot and all devices got discovered now. Will do a bit more testing, but wanted to give quick feedback and send my thanks to you!

@pvint
Copy link
Member

pvint commented Dec 9, 2020

Yes, I just did a fresh test with both an ESP32 and an ESP8266, and both worked fine.

@kbssa I just did it with my Alexa app on my android and it worked fine (I should disconnect all of my Echo devices and test again to be sure though)

@ddweber456
Copy link

Before I open a new issue, let me know if you see anything wrong with the library versions I'm using. Sketch you gave the the other day.

Using library ESP8266WiFi at version 1.0 in folder: C:\Users\David\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\libraries\ESP8266WiFi 
Using library fauxmoESP-master at version 3.1.1 in folder: C:\Users\David\Documents\Arduino\libraries\fauxmoESP-master 
Using library ESPAsyncTCP at version 1.2.2 in folder: C:\Users\David\Documents\Arduino\libraries\ESPAsyncTCP 

Fauxmo master as of 12-6

@pvint
Copy link
Member

pvint commented Dec 9, 2020

I'm using:

Using library ESP8266WiFi at version 1.0 in folder: /home/pvint/.arduino15/packages/esp8266/hardware/esp8266/2.7.4/libraries/ESP8266WiFi 
Using library ESPAsyncTCP at version 1.2.2 in folder: /home/pvint/Arduino/libraries/ESPAsyncTCP 

Looks good.

For reference, here's my Arduino settings:
fauxmoESP-minimal | Arduino 1 8 13_109

@ddweber456
Copy link

ddweber456 commented Dec 9, 2020

I have been using IwIP "v2 Higher Bandwidth", I switch to "v2 Lower Memory" No Success!
Switch to IwIP "v1.4 Higher Bandwidth" Discovery SUCCESS!
I'll do some more testing with different Echo Dots and the App and different sketches and post an update.

Update::
I was able to discover devices with Dot Gen2, Dot Gen3 and the Alexa app (screen add device only).
It appears to be as expected.

I'm assuming the use of IwIP v1.4 vs v2 depends on the flash memory chip? Maybe I just have an older version flash chip.

@pvint
Copy link
Member

pvint commented Dec 9, 2020

Good news!

Interestingly, I always needed "Higher Bandwidth" before (never seemed to matter if it was 1.4 or v2) - I must have been experimenting with something and set it to "lower memory".

@kbssa
Copy link

kbssa commented Dec 9, 2020

@pvint any news about needing of having an echo dot for get the esp discovered by Alexa app ?

@pvint
Copy link
Member

pvint commented Dec 9, 2020

@kbssa I just unplugged all of my Echo devices and tested from my Android phone in the Alexa App, and it did not discover.

Honestly, I've never tried that before, so I'm not sure what to expect. Note that it did work when I did "discover" on the phone in the app when I had 3 Echo devices plugged in. I can look at this more later.

@kbssa
Copy link

kbssa commented Dec 10, 2020

@kbssa I just unplugged all of my Echo devices and tested from my Android phone in the Alexa App, and it did not discover.

Honestly, I've never tried that before, so I'm not sure what to expect. Note that it did work when I did "discover" on the phone in the app when I had 3 Echo devices plugged in. I can look at this more later.

Will get one echo on the next days and I will try that and let you know.

Thank you for testing it for me, saved me a lot of time.

@ddweber456
Copy link

ddweber456 commented Dec 10, 2020

Do the discovery with the phone Alexa App using the screens:

  • Go to Devices
  • Use the Plus "+" at the top of screen
  • Select Add Devices
  • Choose Philips Hue
  • Click on Discover Devices at the bottom of the screen

Worked for me without an Echo, let me know if you had a problem.

@kbssa
Copy link

kbssa commented Dec 10, 2020

Do the discovery with the phone Alexa App using the screens:

  • Go to Devices
  • Use the Plus "+" at the top of screen
  • Select Add Devices
  • Choose Philips Hue
  • Click on Discover Devices at the bottom of the screen

Worked for me without an Echo, let me know if you had a problem.

When try what you said the app ask what hub I have (Philips hue v1, Philips hue v1, echo plus or echo show) so I think without one of these it won't work

@ddweber456
Copy link

I don't have a Philips Hue hub either, but FauxmoESP defines the device as a Philips Hue, I just selected it because it was the closest to what the switch is defined.

@societyofrobots
Copy link

* Go to Devices
* Use the Plus "+" at the top of screen
* Select Add Devices
* Choose Philips Hue
[problem after this step]
* Click on Discover Devices at the bottom of the screen

After I select Philips Hue, I get the same problem kbssa had. There is no 'Discover Devices' option, it just asks me to select a hub. The Discover Devices option, linked elsewhere, doesn't find anything.

I'm using the latest Alexa app version, on Android.

@kbssa
Copy link

kbssa commented Dec 16, 2020

@pvint what echo models do you have ? I am trying with an esp32 and an echo dot Gen3 but no discovery at all.

@JonS9999
Copy link

Hi all.

After a number of unsuccessful attempts over the last year to get fauxmoESP running, I tried it again yesterday, and it now works for me.

Here's what I'm using :

  • Arduino IDE 1.8.13

    • FauxmoESP library installed from Arduino IDE library manager -- by Xose Perez Version 3.1.2
  • ESP8266 -- Wemos D1 Mini

    • Board: LOLIN(WEMOS) D1 R2 & mini
    • IwIP Variant: "1.4 Higher Bandwidth"

I'm doing the discovery/add via the Alexa app on iOS (iPhone 6S).

I do the add/discovery via:

Devices -> (+) -> Add Device -> Other -> Discover Devices

or:

Devices -> (+) -> Add Device -> Plug -> Other -> Discover Devices

The only thing I noticed is that the device comes up as Type: Other. It would be nice if it could come up as a Plug or Light so it could be added to my light groups, etc.

2020-12-17 - 002

Hope this helps.

-Jon

@vishalavalani
Copy link

Hi all.

After a number of unsuccessful attempts over the last year to get fauxmoESP running, I tried it again yesterday, and it now works for me.

Here's what I'm using :

  • Arduino IDE 1.8.13

    • FauxmoESP library installed from Arduino IDE library manager -- by Xose Perez Version 3.1.2
  • ESP8266 -- Wemos D1 Mini

    • Board: LOLIN(WEMOS) D1 R2 & mini
    • IwIP Variant: "1.4 Higher Bandwidth"

I'm doing the discovery/add via the Alexa app on iOS (iPhone 6S).

I do the add/discovery via:

Devices -> (+) -> Add Device -> Other -> Discover Devices

or:

Devices -> (+) -> Add Device -> Plug -> Other -> Discover Devices

The only thing I noticed is that the device comes up as Type: Other. It would be nice if it could come up as a Plug or Light so it could be added to my light groups, etc.

2020-12-17 - 002

Hope this helps.

-Jon

Still not working. Tested it.

@vishalavalani
Copy link

Need help in making it work. Tried all ways but none of it is working to discover devices.

@JonS9999
Copy link

Need help in making it work. Tried all ways but none of it is working to discover devices.

Please post your configuration -- what type of ESP are you using; what your settings are for configuring and programming the ESP; what versions of libraries you're using; what type of Alexa device you're using to discover the ESP; etc...

@pvint
Copy link
Member

pvint commented Dec 20, 2020

For those still having issues with device discovery, please sure that you're using version 3.1.2 (or master branch from git).

For general help in getting it to work, check out #138 in discussions. (And that's likely a better place for general help)

@vishalavalani
Copy link

Upgraded to 3.1.2 and everything works well again. Thank you.

@pvint
Copy link
Member

pvint commented Dec 20, 2020

I believe the original reasons for discovery not working have been resolved, and I'm going to close this issue.

Given that this is bound to be a common and recurring problem (discovery issues), it might be best to use the discussion forum https://github.com/vintlabs/fauxmoESP/discussions for general help (there's already one good post at #138 )

One outstanding issue is that the library has not been updated in PlatformIO (I'm trying to get that done...)

@Snorker8406
Copy link

I finally got a good chance to dig into this this morning, and I think we have something:

It seems as though Alexa isn't liking the "uniqueid" string we are sending (which is just the MAC of the ESP device with the device number appended, ie: AABBCCDDEEFF-01), and simply stripping the "-01" off seems to work.

I've applied the change in the https://github.com/vintlabs/fauxmoESP/tree/discoveryIssue branch, so please test it out and let me know if it's working for you. (Edit: The discoveryIssue branch has been merged to master)

For reference, the changes are:

In fauxmoESP.cpp, change line 127 from:

device.name, mac.c_str(),

To:

device.name, mac.substring(6).c_str(), id,

and change templates.h line 46 from:

"\"uniqueid\":\"%s-%d\","

To:

"\"uniqueid\":\"%s%06d\","

(EDIT: Updated the changes to reflect the newer commit)

I have gone through a few cycles of deleting and re-adding devices, testing control etc, and it seems to be working fine so far, however further testing is needed. Also note: I have only tested with Gen 2 so far, and I did not need to reboot the device.

This worked for me! Many thanks!!!

@Siddhant1410
Copy link

In my case, I left the RX and TX of the ESP8266 module connected to Arduino's RX and TX. Disconnecting everything else and only leaving the VCC and Ground pins connected to ESP8266 did the trick for me.

@mirkan1
Copy link

mirkan1 commented Jul 16, 2023

I got a déjà vu from reading this… Is this related to the issue & proposed changes from espalexa described here? xoseperez/espurna#1904 (comment) Aircoookie/Espalexa@9d57e2c#diff-60d0a10c47ca0f0800ce9f6773faec4aR166 Resulting string is constructed as: uint32_t id = (mac[3] << 20) | (mac[4] << 12) | (mac[5] << 4) | (idx & 0xF); Where the changed replaced uniqueid number with: mac last 3 bytes -dash- deviceId+1 (also note it’s encoded as decimal) Not using Alexa to test / verify this, ESPurna just happens to use fauxmoESP since it was Xose’s project as well 😊

I was having the same problem, switched my library from fauxmo to espalexa and it worked fine, @berab said it might be a problem with your router which is a Verizon router

@jgborges
Copy link

jgborges commented Aug 8, 2023

I also couldn't make Fauxmo work on my device. I succeed with Espalexa, which uses the same Phillips Hue protocol. I was trying to reverse engineer both libs to see what's different, but I have not been able to pinpoint the cause. So far I see two main differences:

  • When listing devices, Espalexa provides a much detailed information when compared to Fauxmo (see here)
  • Fauxmo does not respond to ssdp:all when search UDP request is received (see espalexa and fauxmo)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests